[Python-Dev] Re: Re: def fn (args) [dec,dec]: (original) (raw)

Christophe Cavalaria chris.cavalaria at free.fr
Mon Aug 9 20:43:05 CEST 2004


Greg Ewing wrote:

Guido:

Just look at it when either the list of decorators or the argument list doesn't fit on one line: You don't have to format it quite that badly. def longMethodNameForEffect(longArgumentOne=None, _longArgumentTwo=42) _ [staticmethod, funcattrs(grammar="'@' dottedname [ '(' [arglist] ')' ]", status="experimental", author="BDFL")]:

Am I the only one who finds that it's :

I guess it depends on the amount of decorators you will place on each function. If you place 3-4 decorators per function ( it could easily happen once we get a good and easy to use syntax ), we'll favor a syntax that makes multiline decorator declaration clear and easy to type. The [...] doesn't apply.

On a readability point of view, the @ syntax scales much better with a big number of decorators than the [...] syntax.

Also, the decorators don't have that much effet on what happens between the def and the return. For that reason I find it a mistake to place any decorator information after the def statement.



More information about the Python-Dev mailing list