RFC PEP candidate: q'<delim>'quoted<delim> ?

Terry Reedy tejarex at yahoo.com
Fri Mar 8 09:45:35 EST 2002


"Bengt Richter" <bokr at oz.net> wrote in message
news:a69lml$b2v$0 at 216.39.172.122...
> On Fri, 08 Mar 2002 15:54:29 +1300, Greg Ewing
<greg at cosc.canterbury.ac.nz> wrote:
> >Even something like q'delim' doesn't allow you to
> >easily use completely arbitrary text, because you
> >still have to pick *some* string that doesn't occur
> >in the text. Although you don't have to modify the
> >text, you do have to inspect it in order to choose
> >a suitable delimiter.

> Unless you choose one with vanishingly small probability
> of being included, like a generated guid.

This was Guido's intention when he choose triple quotes and I think he
did excellently well.  I don't believe I had even seen """ and quite
possibly not ''' ever before learning Python.  I do know that I found
""" to be quite jarring, as if I have never seen it before.

> A smart editor could do this for you.

A smart editor could also scan for triple quotes in pasted text and
select one that was not found as the enclosing quotes and do the octal
quoting fixup if both were.

Terry J. Reedy






More information about the Python-list mailing list