[Python-ideas] allow line break at operators

Yingjie Lan lanyjie at yahoo.com
Sat Sep 3 00:18:21 EDT 2011


Have you considered line continuation by indentation? It seems to meet the design principle. I think it is the most natural way to allow free line breaking in Python.

(Sorry, the yahoo web email interface is so weird that I don't know how to format comments between the quoted message below.)




>________________________________
>From: Stephen J. Turnbull <stephen at xemacs.org>
>To: Gabriel AHTUNE <gahtune at gmail.com>
>Cc: Matt Joiner <anacrolix at gmail.com>; "python-list at python.org" <python-list at python.org>; python-ideas <python-ideas at python.org>; Yingjie Lan <lanyjie at yahoo.com>
>Sent: Friday, September 2, 2011 3:28 PM
>Subject: Re: [Python-ideas] allow line break at operators
>
>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.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110902/e413b03e/attachment-0001.html>


More information about the Python-list mailing list