[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

Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant