Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
from functools import wraps
def my_decorator(f):
def wrapper(*args, **kwds):
print('Calling decorated function')
return f(*args, **kwds)
return wrapper
def example():
print('Called example function')
if __name__ == '__main__':
# Calling decorated function
# Called example function
# print(example.__name__)
# 'example'
# print(example.__doc__)
# 'Docstring'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.