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

Paul Moore p.f.moore at gmail.com
Wed Mar 14 12:20:46 EDT 2018


On 14 March 2018 at 15:34, Serhiy Storchaka <storchaka at gmail.com> wrote:
> 10.05.13 21:48, Guido van Rossum пише:
>>
>> I just spent a few minutes staring at a bug caused by a missing comma
>> -- I got a mysterious argument count error because instead of foo('a',
>> 'b') I had written foo('a' 'b').
>>
>> This is a fairly common mistake, and IIRC at Google we even had a lint
>> rule against this (there was also a Python dialect used for some
>> specific purpose where this was explicitly forbidden).
>>
>> Now, with modern compiler technology, we can (and in fact do) evaluate
>> compile-time string literal concatenation with the '+' operator, so
>> there's really no reason to support 'a' 'b' any more. (The reason was
>> always rather flimsy; I copied it from C but the reason why it's
>> needed there doesn't really apply to Python, as it is mostly useful
>> inside macros.)
>>
>> Would it be reasonable to start deprecating this and eventually remove
>> it from the language?
>
>
> This already was discussed 5 years ago. See the topic "Implicit string
> literal concatenation considered harmful?" started by GvR.
>
> https://mail.python.org/pipermail/python-ideas/2013-May/020527.html
>
> First that reviving this discussion please take a look at arguments made at
> former discussion, and make sure that your arguments are new.

To be fair, Guido's post was about removing implicit concatenation,
and much of the subsequent thread was only somewhat related (proposals
for alternative syntax). And the ultimate conclusion from Guido was
that the breakage would be too high.

None of which really relates to the proposal here, which is that we
should "discourage" use without any language change. I'm just not
clear how such discouragement would make any practical difference (I
for one would likely just ignore it).

Paul


More information about the Python-ideas mailing list