[Python-Dev] PEP 3101 Update

Greg Ewing greg.ewing at canterbury.ac.nz
Mon May 8 03:03:21 CEST 2006


Joe Smith wrote:

> AFAICT there would be no way to use raw strings with that method. 
 > ...
> Additional backslashes are added to raw strings to remove anything that 
> resembles an escape sequence.

You seem to be very confused about the way strings work. If
you look at the repr() of a string containing a backslash,
you will see two backslashes, but they're only in the repr(),
*not* in the string itself.

Some things to ponder:

 >>> "\{" == r"\{"
True
 >>> len("\{")
2
 >>> len(r"\{")
2

--
Greg


More information about the Python-Dev mailing list