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

Greg Ewing greg at cosc.canterbury.ac.nz
Mon Aug 9 03:05:48 CEST 2004


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")]:

If you can arrange for the '[' to appear immediately before the first
decorator, I think it makes it a lot easier to recognise the construct
for what it is.

I also think that's a rather untypical decorator argument you've used
there, being full of spaces, brackets and other confounding
characters. That sort of thing is going to look confusing in any
context, whether function decorators are involved or not.

Perhaps someone can post some real-life use cases written with this
syntax, so we can see what it would *really* look like in typical use,
as opposed to made-up worst-case examples?

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg at cosc.canterbury.ac.nz	   +--------------------------------------+


More information about the Python-Dev mailing list