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

Stephen J. Turnbull stephen at xemacs.org
Sat May 11 05:31:06 CEST 2013


MRAB writes:

 > I think I'd go more for a triple-quoted string with a prefix for
 > dedenting and removing newlines:
 > 
 > f = [m'''
 >       abc
 >       def
 >       ghi
 >      ''']
 > 
 > where f == ['abcdefghi'].

Cool enough, but

>>> f = [m'''
...       abc
...        def
...        ghi
...      ''']
>>> f == ['abc def ghi']
True

Worse,

>>> f = [m'''
...       abc 
...       def 
...       ghi
...      ''']
>>> f == ['abc def ghi']
True

Yikes!  (Yeah, I know about consenting adults.)



More information about the Python-ideas mailing list