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

Stephen J. Turnbull stephen at xemacs.org
Sun May 12 05:10:21 CEST 2013


Antoine Pitrou writes:
 > Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:

 > > I believe that distinguishing them visually helps
 > > readability. Using + for both makes things look more
 > > complicated than they really are.

 > Agreed.

In principle, I'm with Guido on this one.  TOOWTDI and EIBTI weigh
heavily with me, and I have been bitten by the "sequence of strings
ends with no comma" bug more than once (though never twice in one day
;-).  Nor do I really care whether concatenation is a runtime or
compile-time operation.  But vox populi is deafening....

BTW, I see no reason not to optimize "'a' + 'b'", as you can always
force runtime evaluation with "''.join(['a','b'])" (which looks insane
here, but probably wouldn't in a case where forcing runtime evaluation
was useful).



More information about the Python-ideas mailing list