Skip to content

Instantly share code, notes, and snippets.

View kootenpv's full-sized avatar

Pascal van Kooten kootenpv

  • Van Kooten AI Solutions / ex-mgnr
  • Utrecht, Netherlands
View GitHub Profile
def optional_arg_decorator(fn):
"""
wrap a decorator so that it can optionally take args/kwargs
when decorating a func
"""
# http://stackoverflow.com/a/32292739/2156113
@wraps(fn)
def wrapped_decorator(*args, **kwargs):
is_bound_method = args and hasattr(args[0], fn.__name__)