Decorators can be used to inject functionality into functions and methods.
def decorator(func):
def wrapper():
print("Before function call")
func()
print("After the function call")
return wrapper
@decorator
def say_whee():
print("Hello world!")