Suggestions to triple quoted strings proposal

Johan Sundström oyasumi at gmail.com
Tue Dec 12 21:55:37 PST 2006


> > If you ignore the first new line, should you also ignore all leading
> > new lines?
>
> No, because line after """ is first line of _text_.
>
> > It's not obvious how it would behave in that situation,
> > which makes it immediately "harder" - but that could be just because I
> > don't understand the use-case. Also, if you actually wanted to include
> > leading newlines you'd then have to use escape sequences which would
> > seem to defeat the whole point of """.
>
> Please explain better, I do not understand.

Assuming that

A) all (and not just the first one, as you suggest) initial newlines
are ignored, and
B) you want to produce a string with leading newlines using the """ syntax,

you would have to use something like """\n\n\nThe string that follows
our leading newlines""".


I personally find """ (and/or ''' -- or is maybe only """ under
discussion?) most unreadable -- how many quotes was that?

It's especially difficult, granted that " and ' characters look much
the same in a forest of quotes, and that i e "'" is a valid
one-character string. At least I can't easily tell the difference,
especially when scanning code, without the aid of some Christmas tree
mode (it gets even worse when discussing code in a non-monospaced
environment). (If the string were to contain actual code, indented
just like the surrounding code too, it gets increasingly worse.)

I would be glad either not to see the change at all, or to see some
alternate syntax, perhaps the more character conservarive #"(string
including literal newlines here" syntax (used by Pike).

-- 
 / Johan Sundström, http://ecmanaut.blogspot.com/




More information about the Es4-discuss mailing list