
On 10 May 2013 20:16, Antoine Pitrou <solipsis@pitrou.net> wrote:
On Fri, 10 May 2013 11:48:51 -0700 Guido van Rossum <guido@python.org> wrote:
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?
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. Michael
Regards
Antoine.
_______________________________________________ Python-ideas mailing list Python-ideas@python.org http://mail.python.org/mailman/listinfo/python-ideas
-- http://www.voidspace.org.uk/ May you do good and not evil May you find forgiveness for yourself and forgive others May you share freely, never taking more than you give. -- the sqlite blessing http://www.sqlite.org/different.html