[Python-Dev] Re: Re: def fn (args) [dec,dec]:
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="'@' dotted_name [ '(' [arglist] ')' ]",
> status="experimental",
> author="BDFL")]:
Am I the only one who finds that it's :
- ugly
- incredibly error prone due to a lot of special cases on each line of code
- a back door for the "how to indent C code" flamewars in Python
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