+ 1
Can anyone explain me decorators in easiest way
3 Antworten
+ 2
Decorator fn:
Hey give me your function, I make a cooler function from it and give it back to to you.
Program: But I can add myself sth. cool!
Decorator: but once defined u can do it with every function
Program:
Hey Decorator okay I call you with @fn before the function I send to to you.
+ 2
A decorator is simply a function that modifies a function and can be called via "@"
+ 2
It's better to read on "habr"