Decorators and Classes | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Decorators and Classes

Could someone help me understand how decorators and classes work?

15th Jan 2018, 5:20 PM
Saikat Alam
Saikat Alam - avatar
2 Answers
+ 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
15th Jan 2018, 8:15 PM
Dread
Dread - avatar
+ 2
Here is an example of what a decorator may be useful for: https://code.sololearn.com/cD09ijlIS6Ev/?ref=app
25th Mar 2018, 4:34 PM
Denys Yeromenko
Denys Yeromenko - avatar