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

Bob Ippolito bob at redivi.com
Sun Mar 28 10:15:55 EST 2004


On Mar 28, 2004, at 9:45 AM, Phillip J. Eby wrote:

> 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.

Not to mention the fact that you'll have to start prefixing your 
function attributes so that you don't clash between decorators.. 
because of the flat namespace.

-bob
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2357 bytes
Desc: not available
Url : http://mail.python.org/pipermail/python-dev/attachments/20040328/80551618/smime-0001.bin


More information about the Python-Dev mailing list