[Python-ideas] PEP8 operator must come before line break

Erik python at lucidity.plus.com
Thu Apr 14 15:27:29 EDT 2016

On 14/04/16 18:23, Guido van Rossum wrote:
> If the discussion ends up with rough consensus on changing this I will
> happily change it back (and change all other occurrences to match the
> new rule).

Interestingly, the sentence above specifically binds the 'and' with what 
follows, via parentheses. It is not part of the preceding text to 
indicate something follows ...

 > however cogent arguments for/against the status quo (or for
 > relinquishing the rule altogether) are welcome.

What I said above pretty much sums up my argument for this (it came up 
in a different context a month or so ago).

I think that is also Matthias's argument (though I won't speak for him).

English speakers will not usually accentuate the 'and's and 'or's in a 
sentence before pausing. To me, I read:

   if foo == bar and \
      baz == spam:

as: "if foo equals bar AND, baz equals spam".

(emphasis on the "and", a pause before 'baz').

Where I will read:

   if  foo == bar \
   and baz == spam:

as: "If foo equals bar, and baz equals spam"

(pause after 'bar').

Just my personal opinion. The problem with this sort of style issue is 
that it's a pattern-based thing. If one is used to reading code written 
with a particular pattern then it's hard to adjust to another. So I 
don't think you'll get a complete consensus one way or the other.


More information about the Python-ideas mailing list