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

Mark Janssen dreamingforward at gmail.com
Sat May 11 20:52:15 CEST 2013


>>> Maybe we could turn ... into a "string continuation
>>> operator":
>>>
>>>   print("This is example %d of a line that is "...
>>>         "too long" % example_number)
>>
>> I think that is an awesome idea.
>
> How is this any better than + in the same position? It's harder to notice, and longer (remember that the only reason you're doing this is that you can't fit your strings into 80 cols).

It partitions the conceptual space.  "+" is a mathematical operator,
but strings are not numbers.  That's the negative argument for it.
The positive, further, argument is that the elipsis has a long history
of being a continuation indicator in text.

> By the way, is it just a coincidence that almost all of the people sticking up for keeping or replacing implicit concatenation instead of just scrapping it are using % formatting in their examples?

An interesting correlation indeed.

-- 
MarkJ
Tacoma, Washington



More information about the Python-ideas mailing list