@decorators

John Roth newsgroups at jhrothjr.com
Fri Aug 6 23:34:44 CEST 2004


"Tim Peters" <tim.peters at gmail.com> wrote in message
news:mailman.1314.1091827156.5135.python-list at python.org...
> [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.

OK. I sit corrected.

John Roth





More information about the Python-list mailing list