Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #12615

Re: [Python-ideas] allow line break at operators

From Dennis Lee Bieber <wlfraed@ix.netcom.com>
Subject Re: [Python-ideas] allow line break at operators
Date 2011-09-01 22:19 -0700
Organization > Bestiaria Support Staff <
References (2 earlier) <1313031175.38817.YahooMailNeo@web121515.mail.ne1.yahoo.com> <CAMZYqRQ+2_trqdffnGJjv=NdB1ZutD69=ZifDa_GqH5zvWuzQw@mail.gmail.com> <4E43D2F2.1090004@mrabarnett.plus.com> <CAB4yi1NDXbROzgf6SGY7P=LWC1pb3DDOZVF6B-fWs_-O3jr8qw@mail.gmail.com> <1314884634.78252.YahooMailNeo@web121507.mail.ne1.yahoo.com>
Newsgroups comp.lang.python
Message-ID <mailman.685.1314940809.27778.python-list@python.org> (permalink)

Show all headers | View raw


On Thu, 1 Sep 2011 06:43:54 -0700 (PDT), Yingjie Lan <lanyjie@yahoo.com>
declaimed the following in gmane.comp.python.general:

> Hi Matt,
> 
> =======================================================
> From: Matt Joiner <anacrolix@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.
> 
	But it really complicates the parsing...

	An open ( explicitly informs that this expression will continue
until a matching closing ) is reached.

	Your proposal says that the compiler can't close an expression until
it has parsed the next line (at minimum).

	And it would mean such ugly things as

	if x - 6 > y
		+ 8
		:
		doThis()

in which the : doesn't require the next line to be indented deeper than
the line it is on OR you end up having to remember that any : needs a
deeper indent below

	if x - 6 > y
		+ 8
		:
			doThis()

	Whereas

	if (x - 6 > y
		+ 8) 
		:
		doThis()

is invalid, and 

	if (x - 6 > y
		+ 8):
		doThis()

is treated AS-IF the source were the unwrapped

	if (x - 6 > y + 8):
		doThis()

Only one increase in level of indentation following the :
-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
        wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: [Python-ideas] allow line break at operators Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2011-09-01 22:19 -0700

csiph-web