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

Steven D'Aprano steve at pearwood.info
Fri May 17 10:49:14 CEST 2013


On 17/05/13 04:28, Ron Adam wrote:

> I think the line continuation '\' character would also make a good explicit string literal concatenation character.  It's already limited to only work across sequential lines as well.

Concatenating strings on the same line is a legitimate thing to do, because you can mix different quoting types. In my opinion, there's no really clean way to build string literals containing multiple types of quotation marks, but implicit concatenation works and is useful. Here's a contrived example:


s = "'Aren't you supposed to be " '"working"?' "', he asked with a wink."


Arguments about whether that is uglier than using backslashes to /dev/null please :-)



-- 
Steven


More information about the Python-ideas mailing list