+ 1
Could someone explain the purpose of a lambda and decorator?
2 ответов
+ 8
a decorator alters the behaviour of a function (and indicates to a reader that it does so through the decorator)
the lambda allows to define an anonymous function, i.e. it allows to work with a function that does not have a "def... " block.
this allows for more readable code when it is a very small function that you only call once (for example).
+ 1
Here is an explanation of the decorator usage:
https://code.sololearn.com/cD09ijlIS6Ev/?ref=app