allow line break at operators

Yingjie Lan lanyjie at
Wed Aug 10 08:05:56 CEST 2011

On Tue, Aug 9, 2011 at 9:42 PM, Yingjie Lan <lanyjie at> wrote:

> Hi all,
> When writing a long expresion, one usually would like to break it into multiple lines. Currently, you may use a '\' to do so, but it looks a little awkward (more like machine-oriented thing). Therefore I start wondering why not allow line breaking at an operator, which is the standard way of breaking a long expression in publication? Here is an example:
> #the old way
> x = 1+2+3+4+\
>       1+2+3+4
> #the new way
> x = 1+2+3+4+ #line continues as it is clearly unfinished
>       1+2+3+4

:# the currently allowed way
:x = (1+2+3+4+
:    1+2+3+4)
:# note the parentheses
:I think this is sufficient.

That works, but not in the most natural way--the way people are customed to...why require a pair of parenthis when we can do without them? Also, the new way does not affect the old ways of doing things at all, it is fully backward compatible. So this just offers a new choice.

> Of course, the dot operator is also included, which may facilitate method chaining:
> x = svg.append( 'circle' ).
>       r(2).cx(1).xy(1).
>       foreground('black').bkground('white')

:Also, I dislike this for the dot operator especially, as it can
:obscure whether a method call or a function call is taking place.

Again, this only offers a new choice, and does not force anybody to do it this way.



More information about the Python-list mailing list