[Python-3000] Raw strings containing \u or \U

Guido van Rossum guido at python.org
Wed May 16 17:46:13 CEST 2007

Walter Doerwald, in private mail, reminded me of a third use case for
raw strings: docstrings containing example code using backslashes.
Here it really seems wrong to interpolate \u and \U.

So this is swaying me towards changing this behavior: r"\u1234" will
be a string of length 6, and r"\U00012345" one of length 10.

I'm still on the fence about the trailing backslash; I personally
prefer to write Windows paths using regular strings and doubled

--Guido van Rossum (home page: http://www.python.org/~guido/)

More information about the Python-3000 mailing list