Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #8072

Re: PEP 8 and indentation of continuation lines

From Ben Finney <ben+python@benfinney.id.au>
Newsgroups comp.lang.python
Subject Re: PEP 8 and indentation of continuation lines
References <eb561969-9ab7-4da5-8be9-dacbc9409bc6@t9g2000vbv.googlegroups.com>
Date 2011-06-21 15:22 +1000
Message-ID <87k4cfpxlf.fsf@benfinney.id.au> (permalink)
Organization Unlimited download news at news.astraweb.com

Show all headers | View raw


John Yeung <gallium.arsenide@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::

    if (
          width == 0 and height == 0 and
          color == 'red' and emphasis == 'strong' or
          highlight > 100):
      raise ValueError("sorry, you lose")

-- 
 \                         “I'm a great lover, I'll bet.” —Emo Philips |
  `\                                                                   |
_o__)                                                                  |
Ben Finney

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

PEP 8 and indentation of continuation lines John Yeung <gallium.arsenide@gmail.com> - 2011-06-20 21:11 -0700
  Re: PEP 8 and indentation of continuation lines Ben Finney <ben+python@benfinney.id.au> - 2011-06-21 15:22 +1000
    Re: PEP 8 and indentation of continuation lines Ben Finney <ben+python@benfinney.id.au> - 2011-06-21 15:39 +1000

csiph-web