What are decorators in Python?
Decorators are used to add some design pattern to a function without changing its structure. Decorators generally are defined before the function they are enhancing.
To apply a decorator, we first define the decorator function it is applied to and simply add the decorator function above the function it has to be applied to. For this, we use @ symbol before the decorator.
Decorators and Generators in Python
Spread the knowledge