String handling bug in Python

Stephen Ferg steve at ferg.org
Fri Apr 26 13:44:34 EDT 2002


The other replies in this thread have answered your question.  Now I'd
like to express sympathy with it.

As a person coming from a non-Unix background (IBM and Windows), I
experienced the same confusion and problems with "raw" strings that
you did.  And I'm sure others will, in the future, also.

I would describe the situation this way... Python's "raw" strings
aren't truly raw at all.  Python does not have any capability for
TRULY raw strings -- that is, for string literals that are not escaped
in any way.  Escaping is still performed even with "raw" strings.  So
the term "raw" is misleading.

I would like to see Python support TRULY raw string literals -- string
literals that are not escaped in any way.  Perhaps they could be added
with a prefix of z (for zero escaping?), so that

     z"\" == "\\"
     z"\'" == "\\\'"

This might help reduce the probability of others experiencing the same
confusions in the future.



More information about the Python-list mailing list