@decorators

Tim Peters tim.peters at gmail.com
Fri Aug 6 23:19:13 CEST 2004


[John Roth]
> ...
> Since I wrote that, I managed to read the new, improved
> and rewritten PEP, and discovered that the new syntax
> doesn't allow parameters.

It does.  What it says is "arbitrary expressions will not work", and I
would agree that's vague if you insisted it was <wink>.  What it means
is that parameters are fine, but things like

@list_of_decorators[index]
@eatme and deco1 or deco2
@random.choice([deco1, deco2, deco3])

are right out.  Note that the PEP still contains examples of
decorators with arguments, and the people who want decorators most
need them to accept arguments.



More information about the Python-list mailing list