3 ms·
What are the differences between decorators and combinators? Didn't get it :\
by k__ 14y ago
What are the differences between decorators and combinators? Didn't get it :\
- stdbrouw 14y agoDecorators take a function and return a new function. 9 times out of 10 they're used as an easy way to create wrappers: do something and then execute the original function, or execute the original function and then process it before handing it off. They're doubly useful in Python because Python has only limited support for functions as blocks. In JavaScript you'd do: var myFunction = addLogging(function(){ ... }) But in Python you'd do @log def my_function(): ...