[Python-Dev] Re: Call for defense of @decorators

damien morton pythondev at bitfurnace.com
Sat Aug 7 06:40:44 CEST 2004


Even though Im basically in favour of the C# style syntax, and mostly 
because I have been using C# a lot and find no problems recognising the 
syntax when I see it, I also find the "decorator on the line after the 
def" syntax appealing.

Allow me to throw this syntax into the ring:

def foo(arg1,arg2):
    \(classmethod)
    blah
    ...

def bar(low,high):
    \(accepts(int,int), returns(float))
    blah
    ...

Allow me to also throw a possible variant

def foo(arg1,arg2): \(classmethod)
    blah
    ...

def bar(low,high): \(accepts(int,int), returns(float))
    blah
    ...

I strongly feel that any decorator syntax will need some kind of matched 
pair to delimit the decorator(s). Angle-brackets (single or double) seem 
very appealing

<classmethod>
def foo(arg1,arg2):
    blah
    ...
<accepts(int,int), returns(float)>
def bar(low,high):
    blah
    ...




More information about the Python-Dev mailing list