allow line break at operators

Chris Angelico rosuav at
Wed Aug 10 12:26:10 CEST 2011

On Wed, Aug 10, 2011 at 10:56 AM, Dan Sommers <dan at> wrote:
> In terms of easier to read, I find code easier to read when the operators
> are at the beginnings of the lines (PEP 8 notwithstanding):
>    x = (someobject.somemethod(object3, thing)
>         + longfunctionname(object2)
>         + otherfunction(value1, value2, value3))

Without the parentheses, this is legal but (probably) useless; it
applies the unary + operator to the return value of those functions.
Putting the + at the end of the previous line at least prevents that,
since most unary operators bind to the operand on the right; but
there's still the potential for ambiguity.

When line breaks are significant, they cannot be randomly inserted
inside expressions.


More information about the Python-list mailing list