Skip to content

Instantly share code, notes, and snippets.

@atucom
Created July 15, 2020 21:41
Show Gist options
  • Save atucom/35c3896a3a09b754d82145402ddf8e0f to your computer and use it in GitHub Desktop.
Save atucom/35c3896a3a09b754d82145402ddf8e0f to your computer and use it in GitHub Desktop.
Debugging decorator to output function and args
def verbose(func):
def output_args(*args, **kwargs):
print("Called {} with: {}".format(func.__name__, [args, kwargs]))
func(*args, **kwargs)
return output_args
@verbose
def say_thing(thing):
print(thing)
say_thing('yolo')
"""Output:
Called say_thing with: [('yolo',), {}]
yolo
"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment