[Python-ideas] allow line break at operators

Yingjie Lan lanyjie at yahoo.com
Fri Sep 2 02:38:01 EDT 2011



Hi Gabriel,

==================================================
From: Gabriel AHTUNE <gahtune at gmail.com>
Subject: Re: [Python-ideas] allow line break at operators


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.

Gabriel AHTUNE

==================================================

That's good to me too, which I proposed early in this thread.
Then somebody would like to have the operator in the
beginning of the next line so that it would stand out.Then still another one said that indentation is good here.
So I finally proposed line continuation with indentation.
Since this is Python, we will live with indentation.
Currently indentation in Python starts a new block,
but if you view it from the perspective of line breaking,
it also function as if the line is continued. The line

if condition: do_a(); do_b()

can be  written as:

if condition: #line breaks
do_a(); # ';' is optional here 
do_b() # continue

Sounds a pretty natural way to allow free line breaking.


Yingjie
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110901/ed827bfb/attachment.html>


More information about the Python-list mailing list