Re: python strings

Guido.van.Rossum@cwi.nl
Thu, 28 Apr 1994 17:17:57 +0200

> Another vote against triple quotes. While I don't do a thousandth of the
> serious Python programming that others in this group do, the aesthete in
> me visibly twitched when I saw the triple-quotes proposal. The backslash
> solution didn't inflame me, though, for what it's worth.

There simply isn't one solution that will work for all cases.

You really need the backslash version if you have a very long string
WITHOUT newlines that you want to fold across multiple physical lines.

On the other hand it is a pain to terminate every line with \n\ if
you are simply incorporating long paragraphs of preformatted text in
your program -- so that's where triple quotes are best.

String concatenation using the + operator will be costly in certain
cases -- and we can't yet count on an optimizer. There simplay ain't
one and there won't be one for quite a while.

Concatenation through juxtaposition -- well I don't care too much for
it but it's the only solution that lets you indent the strings as you
please without a performance hit.

Finally: I sort of default to doing things the C way unless I have a
significantly better way...

--Guido van Rossum, CWI, Amsterdam <Guido.van.Rossum@cwi.nl>
URL: <http://www.cwi.nl/cwi/people/Guido.van.Rossum.html>