Implicit string literal concatenation considered harmful?
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? -- --Guido van Rossum (python.org/~guido)
participants (51)
-
alex23
-
Alexander Belopolsky
-
Andrew Barnert
-
Antoine Pitrou
-
Antonio Messina
-
Barry Warsaw
-
Ben Darnell
-
Bruce Leban
-
Cameron Simpson
-
Chris Angelico
-
Chris Kaynor
-
Christian Tismer
-
Dave Peticolas
-
Eli Bendersky
-
Ethan Furman
-
Ezio Melotti
-
Georg Brandl
-
Greg Ewing
-
Gregory P. Smith
-
Guido van Rossum
-
Haoyi Li
-
Ian Cordasco
-
INADA Naoki
-
Jan Kaliszewski
-
Jim Jewett
-
Joao S. O. Bueno
-
João Bernardo
-
Juancarlo Añez
-
Kabie
-
M.-A. Lemburg
-
Mark Dickinson
-
Mark Janssen
-
Mark Lawrence
-
Markus Unterwaditzer
-
Matt Chaput
-
Michael Foord
-
Michael Mitchell
-
MRAB
-
Ned Batchelder
-
Nick Coghlan
-
Paul Moore
-
Philip Jenvey
-
Random832
-
Raymond Hettinger
-
Ron Adam
-
rurpy@yahoo.com
-
Serhiy Storchaka
-
Stefan Behnel
-
Stefan Drees
-
Stephen J. Turnbull
-
Steven D'Aprano