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


Groups > comp.lang.python > #12615 > unrolled thread

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

Started byDennis Lee Bieber <wlfraed@ix.netcom.com>
First post2011-09-01 22:19 -0700
Last post2011-09-01 22:19 -0700
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

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

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

FromDennis Lee Bieber <wlfraed@ix.netcom.com>
Date2011-09-01 22:19 -0700
SubjectRe: [Python-ideas] allow line break at operators
Message-ID<mailman.685.1314940809.27778.python-list@python.org>
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/

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web