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

Christian Tismer tismer at stackless.com
Sat May 11 18:37:54 CEST 2013


On 11.05.13 11:37, Stefan Behnel wrote:
> Georg Brandl, 11.05.2013 07:24:
>> Am 11.05.2013 01:43, schrieb Philip Jenvey:
>>> On May 10, 2013, at 1:09 PM, Michael Foord wrote:
>>>> On 10 May 2013 20:16, Antoine Pitrou wrote:
>>>>
>>>> I'm rather -1. It's quite convenient and I don't want to add some '+'
>>>> signs everywhere I use it. I'm sure many people also have long string
>>>> literals out there and will have to endure the pain of a dull task to
>>>> "fix" their code.
>>>>
>>>> However, in your case, foo('a' 'b') could raise a SyntaxWarning, since
>>>> the "continuation" is on the same line.
>>>>
>>>> I'm with Antoine. I love using implicit concatenation for splitting long literals across multiple lines.
>>> Strongly -1 on this proposal, I also use this quite often.
>> -1 here. I use it a lot too, and find it very convenient, and while I could
>> live with the change, I think it should have been made together with the lot
>> of other syntax changes going to Python 3.
> I used to sort-of dislike it in the past and only recently started using it
> more often, specifically for dealing with long string literals. I really
> like it for that, although I've also been bitten by the "missing comma" bug.
>
> I guess I'm -0.5 on removing it.
>

I'm +1 on removing it, if it is combined with better indentation options
for triple-quoted strings.

So if there was some notation (not specified yet how) that triggers correct
indentation at compile time without extra functional hacks, so that

     long_text = """
       this text is left justified
         and this line indents by two spaces
       """

is stripped the leading and trailing \n and indentation is justified,
then I think the need for the implicit whitespace operator would be small.

cheers -- chris

-- 
Christian Tismer             :^)   <mailto:tismer at stackless.com>
Software Consulting          :     Have a break! Take a ride on Python's
Karl-Liebknecht-Str. 121     :    *Starship* http://starship.python.net/
14482 Potsdam                :     PGP key -> http://pgp.uni-mainz.de
phone +49 173 24 18 776  fax +49 (30) 700143-0023
PGP 0x57F3BF04       9064 F4E1 D754 C2FF 1619  305B C09C 5A3B 57F3 BF04
       whom do you want to sponsor today?   http://www.stackless.com/




More information about the Python-ideas mailing list