Study
Python · Decorators
Functions as objects, closures, writing decorators with functools.wraps, and decorators that take arguments.
- @decorator above def f is just f = decorator(f).
- functools.wraps copies the original function's name and docstring onto the wrapper.