[Python-ideas] allow line break at operators

Yingjie Lan lanyjie at yahoo.com
Fri Sep 2 02:45:07 EDT 2011


Yeah, that might be a challenge for the Python interpreter, for it has to check if the next line is indented or not. But it might be worthwhile to take this trouble, so that the coder has more freedom, and the code is hopefully better to read.


________________________________
From: Matt Joiner <anacrolix at gmail.com>
To: Yingjie Lan <lanyjie at yahoo.com>
Cc: "python-list at python.org" <python-list at python.org>; python-ideas <python-ideas at python.org>
Sent: Friday, September 2, 2011 1:33 PM
Subject: Re: [Python-ideas] allow line break at operators

I guess the issue here is that you can't tell if an expression is
complete without checking the indent of the following line. This is
likely not desirable.

On Thu, Sep 1, 2011 at 11:43 PM, Yingjie Lan <lanyjie at yahoo.com> wrote:
> Hi Matt,
> =======================================================
> From: Matt Joiner <anacrolix at gmail.com>
>
> The "trailing \" workaround is nonobvious. Wrapping in () is noisy and
> already heavily used by other syntactical structures.
> =======================================================
> How about only require indentation
> to freely break lines? Here is an example:
> x = firstpart * secondpart #line breaks here
> + anotherpart #continue by indentation
> + stillanother #continue on.
> #until here, another line starts by dedentation
> y = some_expression - another_one
> All this would be completely compatible with former code, while
> having almost free line breaking! Plus, indentation makes it pretty.
> Really hope Python can have freedom in breaking lines.
> Yingjie
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110901/093fca98/attachment-0001.html>


More information about the Python-list mailing list