[Python-ideas] allow line break at operators

Gabriel AHTUNE gahtune at gmail.com
Fri Sep 2 08:14:12 CEST 2011


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


2011/9/2 Matt Joiner <anacrolix at gmail.com>

> 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
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> http://mail.python.org/mailman/listinfo/python-ideas
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110902/7eed444b/attachment.html>


More information about the Python-list mailing list