PEP 8 and indentation of continuation lines
Ben Finney
ben+python at benfinney.id.au
Tue Jun 21 01:39:09 EDT 2011
Ben Finney <ben+python at benfinney.id.au> writes:
> John Yeung <gallium.arsenide at gmail.com> writes:
>
> > So last week PEP 8 was updated to reflect this. All fine and good. I
> > happen to prefer this style myself. But there remains an example
> > further down (left over from earlier incarnations of PEP 8) which
> > might go against this:
> >
> > if (width == 0 and height == 0 and
> > color == 'red' and emphasis == 'strong' or
> > highlight > 100):
> > raise ValueError("sorry, you lose")
> >
> > The above satisfies the "opening paren" alignment, but due to the
> > length of the keyword, the suite is obscured. For this example,
> > should PEP 8 use the double-indentation for the continuation lines?
>
> I wrote some code just today that needs the above issue addressed. I
> did it like this::
The formatting was messed up. Since the whitespace is the whole point
here, this is what I intended to send::
if (
width == 0 and height == 0 and
color == 'red' and emphasis == 'strong' or
highlight > 100):
raise ValueError("sorry, you lose")
--
\ “The process by which banks create money is so simple that the |
`\ mind is repelled.” —John Kenneth Galbraith, _Money: Whence It |
_o__) Came, Where It Went_, 1975 |
Ben Finney
More information about the Python-list
mailing list