4 ms·
>I think its safe to say that the current view of what decorators do is, a) filter things going to functions (so they error, or hit a cache), or b) register a f
by wcummings 10y ago
>I think its safe to say that the current view of what decorators do is, a) filter things going to functions (so they error, or hit a cache), or b) register a function with another library (e.g. flask path decorator)
Why is it safe to say that? Aren't decorators just syntax for higher-order functions?
- RubyPinch 10y agoits "safe" to say that, like its also "safe" to say that <article> will be used to denote articles in HTML Yes, decorators can do whatever they want, but, in practical usage I'd say a majority of decorator usages do not mutate the class/function significantly from its original typed-out intent (like, they don't often add 8+ methods to a class for example, but of course they can) not literally "safe" to say.