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

Dave Peticolas dave at krondo.com
Fri May 10 20:58:49 CEST 2013


2013/5/10 Guido van Rossum <guido at python.org>

> 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?


>From my perspective as a Python user (not knowing anything about the
ramifications for the required changes to the parser, etc.) it is very
reasonable.
This bug is very hard to spot when it happens, and an argument count error
is really one of the more benign forms it can take.



>
> --
> --Guido van Rossum (python.org/~guido)
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> http://mail.python.org/mailman/listinfo/python-ideas
>



-- 
--Dave Peticolas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20130510/c645aa24/attachment.html>


More information about the Python-ideas mailing list