[Python-ideas] Minor tweak to PEP 8?

Mike Meyer mwm at mired.org
Tue May 10 16:47:54 CEST 2011


PEP eight has an interesting omission in the "Code Layout" section. It
doesn't say how to indent continuation lines when code is wrapped to
comply with the line length limits. It has examples, but no textual
guides. Which means you can do a rock-stupid word warp (with no
indentation on the continuation lines), point at the resulting mess,
and say "See? If we follow this part of the PEP, we get really ugly
code!". Mail doing just that is what prompted this suggestion.

I therefore propose adding a sentence or two to this section,
something along the lines of:

    The continuation line(s) should be indented to reflect the
    structure of the statement being continued. This should be at
    least one space beyond the first open parenthesis that is not
    closed on the continued line, if present.

Nothing hard and fast, just a requirement to use good sense and the
minimal indent resulting from doing so.

    <mike
-- 
Mike Meyer <mwm at mired.org>		http://www.mired.org/
Independent Software developer/SCM consultant, email for more information.

O< ascii ribbon campaign - stop html mail - www.asciiribbon.org



More information about the Python-ideas mailing list