In Decorator: Basics, we have seen the basics of decorators.
import functools def decorator(func): @functools.wraps(func) def wrapper_decorator(*args, **kwargs): # Do something before value = func(*args, **kwargs) # Do something after return value return wrapper_decorator The key is to remember the following two expressions are equivalent (the latter uses the syntactic sugar):