[Python-Dev] 2.4a2, and @decorators

Bob Ippolito bob at redivi.com
Tue Aug 3 07:28:00 CEST 2004


On Aug 2, 2004, at 12:54 PM, Raymond Hettinger wrote:

>>> The only real necessary restriction on the @ operator is that its
>>> argument be callable and take a single argument. Many expressions
> could
>>> return a callable object. Why not let them? Is it really worth
> having a
>>> special case just to SyntaxError expressions that sometimes won't
> result
>>> in an appropriate callable?
>>>
>>> Things someone might want to do, ordered roughly from most
> reasonable to
>>> least reasonable ;)
>>> @foo().bar()
>>> @foo or bar
>>> @mydecorators['foo']
>>> @lambda f: foo(f) or bar(f)
>>>
>>> Why disallow these forms? It seems quite difficult, especially, to
>>> explain why the first one does not, or should not, work.
>>>
>>> James
>>>
>>
>>    For what it's worth, I agree with James completely.
>>
>>    Jp
>
> I concur.
>
>
> Raymond

Ditto.

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


More information about the Python-Dev mailing list