[Python-ideas] Decorator syntax

Georg Brandl g.brandl at gmx.net
Thu Sep 3 13:27:05 CEST 2009


MRAB schrieb:

>> I do see a reason.  I have no problems with
>> 
>>    @foo.bar
>>    @foo.bar[baz]
>>    @foo.bar(baz)
>> 
>> But this is ugly to me:
>> 
>>    @a + b
>>    def foo(): pass
>> 
> Ugly, yes.
> 
>> As is this:
>> 
>>    @a or (c and d)
>>    def foo(): pass
>> 
> Agreed.

Good :)

>> Having the decorator expression "opened" by @ but not "closed" feels bad.
>> 
> But:
> 
>      @foo
> 
> isn't "closed" either.

Hmm, the above is probably a bad expression of my "feeling" :) but I think
you know what I mean.

Georg

-- 
Thus spake the Lord: Thou shalt indent with four spaces. No more, no less.
Four shall be the number of spaces thou shalt indent, and the number of thy
indenting shall be four. Eight shalt thou not indent, nor either indent thou
two, excepting that thou then proceed to four. Tabs are right out.




More information about the Python-ideas mailing list