+ 1
Decorators and Classes
Could someone help me understand how decorators and classes work?
2 Respostas
+ 2
A decorator:
By definition, a decorator is a function that takes another function and extends the behavior of the latter function without explicitly modifying it.
A class:
Classes are constructs that let you structure your software in a particular way. Using classes, you can add consistency to your programs so that they can be used in a cleaner way. At least that's the theory.
Reference: realpython.com
+ 2
Here is an example of what a decorator may be useful for:
https://code.sololearn.com/cD09ijlIS6Ev/?ref=app