Decorators: simple example
- A decorator is that
@somethingjust before the declaration of the function. - Decorators can modify the behavior of functions or can set some meta information about them.
- In this book first we’ll see a few examples of existing decorators of Python and 3rd party libraries.
- Then we’ll learn when and how to create our own decorators.
- Then we’ll take a look at the implementation of some of the well-known decorators.
@some_decorator
def some_function():
pass