[Python-ideas] allow line break at operators

Stephen J. Turnbull stephen at xemacs.org
Fri Sep 2 03:28:16 EDT 2011


Gabriel AHTUNE writes:
 > So can be done with this syntax:
 > 
 > > x = firstpart * secondpart  +  #line breaks here
 > > anotherpart + #continue
 > > stillanother #continue on.
 > 
 > after a "+" operator the line is clearly not finished yet.

Sure, but IIRC one design principle of Python is that the keyword that
denotes the syntax should be the first thing on the line, making it
easy to scan down the left side of the code to see the syntactic
structure.  The required indentation of the controlled suite also
helps emphasize that keyword.

Analogously, if operators are going to denote continuation, they
should come first on the line.

I just don't think this idea is going anywhere.  Explicit continuation
with backslash or implicit continuation of parenthesized expressions
is just not that heavy a price to pay.  Perhaps historically some of
these ideas could have been implemented, but now they're just going to
confuse a host of editors and code analysis tools.



More information about the Python-list mailing list