3 ms·
"A decorator is just an expression that will be evaluated and has to return a function." It seems to me that it's just sugar for wrapping functions... is there
by mrspeaker 11y ago
"A decorator is just an expression that will be evaluated and has to return a function." It seems to me that it's just sugar for wrapping functions... is there some reason that couldn't be optimized?
- ubernostrum 11y agoIn Python, the decorator syntax is literally just syntactic sugar. This: @some_decorator def some_func(): pass Is equivalent to this: def some_func(): pass some_func = some_decorator(some_func)