[Python-ideas] Implicit string literal concatenation considered harmful?
Joao S. O. Bueno
jsbueno at python.org.br
Sat May 11 16:21:02 CEST 2013
Please - check my e-mail correctly
On 11 May 2013 00:31, Stephen J. Turnbull <stephen at xemacs.org> wrote:
> 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
> > ''']
> >
I think the prefix idea is obvious - and I used the letter "i" in my message -
for "idented" -0 it may be a pooorr choice indeed since it looks like
it may not be
noticed sometimes close to the quotes.
> > where f == ['abcdefghi'].
>
> Cool enough, but
>
>>>> f = [m'''
> ... abc
> ... def
> ... ghi
> ... ''']
>>>> f == ['abc def ghi']
> True
In my porposal, this woukld yield a Syntax Error - any contents of the
string would have to be
indented to the same level of the prefix. Sorry if that was not clear enough.
>
> Worse,
>
>>>> f = [m'''
> ... abc
> ... def
> ... ghi
> ... ''']
>>>> f == ['abc def ghi']
> True
>
> Yikes! (Yeah, I know about consenting adults.)
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> http://mail.python.org/mailman/listinfo/python-ideas
More information about the Python-ideas
mailing list