Re: python strings

Jaap Vermeulen (
Tue, 26 Apr 94 14:27:00 PDT

[This response is not directed to Tim in particular.]

| each double quote within the string. But within a triple-quoted string,
| embedded single and double quotes in isolation, or even in pairs, need
| not be escaped.

Forgot about that one. Yeah, I can see some benefit. Unless you need three
quotes, what is the escape sequence for that? And what about 'A test called
"test"' with triple double quotes?

"""A test called "test""""

(I can see the parser complain here...)

| A second feature is that runaway strings are very easy to find if they're
| introduced by the obnoxious '"""'.

Moot. If you have '"""' all over the place, it's not going to matter any

| A third feature was the hope that some well-defined amount of leading
| whitespace could be stripped from the lines of a multi-line string
| automagically. Can't do that for the "..." or '...' form of strings,
| because it would change the meaning of some currently-correct programs.
| But this last one doesn't appear to apply anymore ('tho it should <wink>).

Blech! I hate that feature. How are you going to determine the right amount
of whitespace to trim? And what if you want whitespace? No, better to do
that in explicit functions, such as a rewritten string.strip() (rewritten to
strip around newlines as well).

| summarizingly y'rs - tim

Thanks for bringing me up to speed. I appreciate it.

I guess the tree double quotes where just arbitrary; you can use any unique
delimiter. I guess, it would be nice if you could choose the delimiter, as
in the substitute command of sed or ex (vi). Suppose it would be the
character following the triple double quote, the above test could be
rewritten as:

"""'A test called "test"'