[Python-ideas] Implicit string literal concatenation considered harmful?

Chris Kaynor ckaynor at zindagigames.com
Fri May 17 19:07:49 CEST 2013


On Fri, May 17, 2013 at 4:09 AM, Chris Angelico <rosuav at gmail.com> wrote:

> On Fri, May 17, 2013 at 7:55 PM, Joao S. O. Bueno <jsbueno at python.org.br>
> wrote:
> > On 16 May 2013 16:29, MRAB <python at mrabarnett.plus.com> wrote:
> >> The suggestion was to use it in place of implicit string concatenation,
> >> which occurs only between string _literals_:
> >>
> >> print ("Hello" . " World")
> >>
> >> and is currently illegal ("SyntaxError: invalid syntax").
> >
> > What is that? One thing that works in a way for literals and
> > in another way for expressions?
> > Sorry, but there is onlye one word for this: Insanity!
>
> One of the things I love about Python is that a "thing" can be used in
> the same ways whether it's from a literal, a variable/name lookup, a
> function return value, a class member, an instance member, etc, etc,
> etc. (Sometimes this requires strange magic, like member function
> calling, but you still have the principle that "a=foo.bar(quux)" and
> "_=foo.bar; a=_(quux)" do the same thing.) So anything that makes
> str.str mean something weird gets a -1 from me. The proposals
> involving ellipsis have at least the virtue that it's clearly a
> syntactic element and not an operator, but I suspect the syntax will
> be more problematic than useful.
>
> If it looks like an operator, it should BE an operator.


Just to point out that the "." is already overloaded in some cases in
Python. Take a look at this literal: 1.2
Surely, that should mean the 2 attribute of the integer 1, correct?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20130517/4152b20e/attachment-0001.html>


More information about the Python-ideas mailing list