emacs in python mode does the correct thing, says the styleguide.

Laura Creighton lac at cd.chalmers.se
Wed May 2 08:33:02 EDT 2001

But I do not think so.  Here is the example given:

    def __init__(self, width, height,
                 color='black', emphasis=None, highlight=0):
        if width == 0 and height == 0 and \
           color == 'red' and emphasis == 'strong' or \
           highlight > 100:
            raise ValueError, "sorry, you lose"
        if width == 0 and height == 0 and (color == 'red' or
                                           emphasis is None):
            raise ValueError, "I don't think so"
        Blob.__init__(self, widt, height,
                      color, emphasis, highlight)


I think that lining up continuation lines to match the first open
round parenthesis is rather silly.  If instead of __init__ the function
was called ReallyDescriptiveLongNamedGraphicalWidgetWithBellsOnIt
you wouldn't have room to pass any arguments to it at all. :-)  I
have caught myself shortening variable names in order to get things
to fit on `only one line'.  I can easily see myself deciding that `hl' is 
a much better variable name than `highlight' if calling it `highlight'
would push the function definition to 3 lines rather than 2.
Is there some compelling reason to want this behavior, rather than, for 
instance, one more indentation level than the line you are currently on
that I am unaware of?

Laura Creighton
lac at cd.chalmers.se

More information about the Python-list mailing list