On Thu, Apr 14, 2016 at 12:28 PM, Joseph Martinot-Lagarde <
contrebasse@gmail.com> wrote:
> Guido van Rossum <guido@...> writes:
>
>> My rationale for this rule is that ending a line in a binary operator
>> is a clear hint to the reader that the line isn't finished. (If you
>> think about it, a comma is a kind of binary operator, and you wouldn't
>> move the comma to the start of the continuation line, would you?
>
> I personally tend to look more at the start of the lines because that's
> where the blocks are defined (by indentation). Also the end of the lines are
> usually not aligned which makes binary operators harder to see.
> Because of these two reasons I always put binary operator at the start of
> new lines, because that's where I have the most chance to see them, and I'm
> in favor of changing this in PEP8.
This is the case that jumped to mind for me as well...
If I saw code like this in a code review I'd force the author to change it because the style is outright misleading:
return (something1() +
a * b +
some_other_thing() ** 2 -
f -
normalizer)
We're summing a list of items with some things being negated, but that structure is impossible to see, and worst of all, the association between the operator and the thing being operated on is totally lost. OTOH if we write like this: