Home
Reading
Searching
Subscribe
Sponsors
Statistics
Posting
Contact
Spam
Lists
Links
About
Hosting
Filtering
Features Download
Marketing
Archives
FAQ
Blog
 
Gmane
From: Stephen J. Turnbull <stephen-Sn97VrDLz2sdnm+yROfE0A <at> public.gmane.org>
Subject: Re: Implicit string literal concatenation considered harmful?
Newsgroups: gmane.comp.python.ideas
Date: Sunday 12th May 2013 00:30:04 UTC (over 4 years ago)
Mark Janssen writes:

 > >  > I think that is an awesome idea.
 > >
 > > Violates TOOWTDI.
 > >
 > >     >>> print("This is an" +          # traditional explicit operator
 > >     ...  " %s idea." % ("awesome" if False else "unimpressive"))
 > >     This is an unimpressive idea.
 > >     >>>
 > 
 > But you see you just helped me demonstrate my point:  the Python
 > interpreter *itself* uses ... as a line-continuation operater!

No, it doesn't.  It's a (physical) line *separator* there.  This:

>>> "This is a syntax" +
  File "", line 1
    "this is a syntax " +
                        ^
SyntaxError: invalid syntax
>>> 

is a syntax error.  If "... " were a line continuation, it would
be a prompt for the rest of the line, but you never get there.

 > Also, it won't violate TOOWTDI if the "+" operator is deprecated for
 > strings.  Strings are different from numbers anyway, it's an old
 > habit/wart to use "+" for them.

They're both just mathematical objects that have operations defined on
them.  Although in math we usually express multiplication by
juxtaposition, I personally think EIBTI applies here.  Ie, IMO using
"+" makes a lot of sense although the precedence argument is a good
one (but not good enough for introducing another operator, especially
using a symbol that already has a different syntactic meaning).

I think it's pretty clear that deprecating compile-time concatenation
by juxtaposition would be massively unpopular, so the deprecation
should be delayed until there's a truly attractive alternative.

I think the various proposals for a dedenting syntax come close, but
there remains too much resistance for my taste, and I suspect Guido
won't push it.  I also agree with those who think that it probably 
should wait for Python 4, given that it was apparently considered and
rejected for Python 3.
 
CD: 3ms