- A decorator is a design pattern in Python that allows a user to add new functionality to an existing object without modifying its structure.
- It allows programmers to modify the behavior of function or class.
- Decorators allow us to wrap another function in order to extend the behavior of wrapped function, without permanently modifying it.
- In Decorators, functions are taken as the argument into another function and then called inside the wrapper function.
- Decorators are usually called before the definition of a function you want to decorate.
- A decorator is a function that takes a function as its only parameter and returns a function. This is helpful to “wrap” functionality with the same code over and over again.
* Authorization in Python frameworks such as Flask and Django
* Logging
* Measuring execution time
* Synchronization
- https://realpython.com/primer-on-python-decorators/