[Python-Dev] Re: method decorators (PEP 318)

Phillip J. Eby pje at telecommunity.com
Sun Mar 28 09:45:14 EST 2004


At 12:54 PM 3/28/04 +0100, Paul Moore wrote:
>Robert Mollitor <mollitor at earthlink.net> writes:
>
> > It would be nice if transformer decorations were never allowed
> > "arguments".  It would keep that list as short
> > and as tidy as possible.
>
>That's the sort of restriction I imagined that Guido was tending
>towards. While it's justifiable in this context, I would prefer to
>leave the option of using arguments available, in case someone comes
>up with a use where function attributes are inappropriate.

It's inappropriate to use attributes of a function for attributes that 
logically belong to the decorator.  For 
example  'synchronized(lockattr="baz")'.  The 'lockattr' logically belongs 
to the synchronizing decoration.  Declaring it in a separate location makes 
the whole thing harder to read/understand.






More information about the Python-Dev mailing list