Given a function:
def example():
return
Given a function that takes as one of its inputs a function (we'll call this our decorator):
def example_decorator(function):
# do something
function()
# do something else
We can then decorate the example
function with example_decorator
like so:
@example_decorator
def example():
return
When we call example
, the semantics are:
example() == example_decorator(example)