Source Code:
(back to article)
import functools def my_decorator(f): @functools.wraps(f) def wrapper(*args, **kwds): print("Calling decorated function") return f(*args, **kwds) return wrapper @my_decorator def example(): """Docstring""" print("Called example function") print(example.__name__) #example print(example.__doc__) #Docstring
Result:
Report an issue