[Python-3000] Line continuation using ellipsis
g.brandl at gmx.net
Wed Apr 11 18:08:36 CEST 2007
> I'm not sure that I am the first to bring this up, but I might as well
> get it written down.
> I've never liked using the backslash operator for line continuation, for
> two reasons:
> 1) It requires that it be the last character of a line, meaning that you
> have to insure that there's no trailing whitespace, which can be
> difficult with some editors.
Then use parentheses. That should be possible almost everywhere.
Also, if we have to have a line-continuation token, the backslash is a
good choice because it's present in so many other languages.
> 2) As a wise sage once said, "it looks like line noise on my monitor".
But it's end-of-line noise ;)
> I'm not proposing to remove the feature, however I'd like to see an
> alternative method for declaring statements that cross a line boundary.
> I seem to recall at one point someone suggesting the use of ellipsis,
> which makes a lot of sense to me:
> sorted_result = partition_lower( input_list, pivot ) ...
> + pivot ...
> + partition_upper( input_list, pivot )
> Parsing-wise, an ellipsis operator would have the following meaning:
> Inside a parenthesized or bracketed expression, it would have the same
> meaning it does now. Otherwise, it has the meaning "consume all
> whitespace, including newlines".
This doesn't work with Py3k as the ellipsis is a general expression element
there. You can already write
and it will be short for
Thus spake the Lord: Thou shalt indent with four spaces. No more, no less.
Four shall be the number of spaces thou shalt indent, and the number of thy
indenting shall be four. Eight shalt thou not indent, nor either indent thou
two, excepting that thou then proceed to four. Tabs are right out.
More information about the Python-3000