3 ms·
Annotation and registration are indeed common and proper uses of decorators. What I dislike are mostly the inputs 8, 9, 13, 14, and 23 that could give nasty id
by ramnes 9y ago
Annotation and registration are indeed common and proper uses of decorators.
What I dislike are mostly the inputs 8, 9, 13, 14, and 23 that could give nasty ideas to an inexperienced developer, while a more experienced developer wouldn't need them to understand that a decorator is just a syntactic sugar and that, yes, "applying a decorator d to a function x [is] the same as writing the definition of x, then x = d(x)" (which the author seems to refute).
I understand that those examples are solely intended to show that "it works", but they aren't educational to me.
- wcr3 9y agoAgreed. 6 is misleading as well. Seems like fodder for more mistakes, if anything.