Chris Kaynor writes:
 > Guido's time machine strikes again, though using a slash (\) rather than
 > elipse:
 > 
 > >>> '.'\
 > ... .join(
 > ...     (
 > ...             '1',
 > ...             '2',
 > ...     )
 > ... )
 > '1.2'
 > 
 > This is from Python 2.7.10 (what I have on the machine I am currently on),
 > though I'm fairly sure it has worked for quite a bit longer than that.

I expect Shane is aware of that.  There are three issues.  First, the
ellipsis is more visible, and because it's syntactic rather than
lexical, trailing whitespace (line comments!) isn't a problem.

Second, more important, Shane wants indentation enforced by the
parser, which requires a syntactic line break.

I'll add a third, which Shane may have meant to imply.  That is, to
get '\' to work with more general expressions (specifically, embedded
function calls with arguments that are long enough to themselves
require physical line breaks), you need to put in an escaped newline
at each such.  Shane's idea is that at the *first* physical linebreak,
you put in the ellipsis, and after that your expression *must* obey
pythonic indentation rules until the end of that expression.
N.B. "Pythonic" rather than "Python" because Python currently doesn't
have indentation rules for expressions, and the analogy to suite
indentation will be imperfect, I suspect.

Analogy (very inaccurate): "readable" regexp syntax.

As yet, I have no opinion of the proposal itself, but it's clearly
more powerful than your reply suggests.

_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to