[Python-ideas] decorator syntax limitation

Steven D'Aprano steve at pearwood.info
Thu Feb 20 22:49:38 CET 2014


On Thu, Feb 20, 2014 at 10:31:45PM +0100, Franck Michea wrote:
> Hi there,
> 
> Today I hit a limitation of decorator syntax, and I was wondering if
> maybe this limitation could be removed, or if they could allow more.


I recall that the limitation on decorator syntax was deliberate, because 
people weren't sure how confusing it would be to allow arbitrary 
expressions.

I think that it might be time to extend the allowed syntax a bit. I 
think it is perfectly reasonable to allow:

>     @M(b).decorator()
>     def wrapped_func():
>         pass

as syntax.


-- 
Steven


More information about the Python-ideas mailing list