[Python-ideas] Problems (and solutions?) in writing decorators

Greg Ewing greg.ewing at canterbury.ac.nz
Tue Mar 19 18:18:21 EDT 2019


Sylvain MARIE via Python-ideas wrote:
> `my_decorator(foo)` when foo is a callable will always look like
> `@my_decorator` applied to function foo, because that's how the language is
> designed.

I don't think it's worth doing anything to change that. Everywhere
else in the language, there's a very clear distinction between
'foo' and 'foo()', and you confuse them at your peril. I don't see
why decorators should be any different.

-- 
Greg


More information about the Python-ideas mailing list