[Python-3000] raw strings and \u
Guido van Rossum
guido at python.org
Sat Apr 5 16:44:10 CEST 2008
On Fri, Apr 4, 2008 at 11:18 PM, Neal Norwitz <nnorwitz at gmail.com> wrote:
> I just checked in r62163 with this change:
> - rc = os.system(r"ml64 -c -Foms\uptable.obj ms\uptable.asm")
> + rc = os.system("ml64 -c -Foms\\uptable.obj ms\\uptable.asm")
> What should happen with raw unicode strings that contain a \u? The
> old code above was generating:
> SyntaxError: (unicode error) truncated \uXXXX
> Is that correct? Or should the \u be translated literally?
Oops, there's a regression!!!
In 2.x, \uDDDD and \UDDDDDDDD are interpreted as Unicode escapes in
raw Unicode strings. That was a mistake, but we can't fix it (except
when using "from __future__ import unicode_literals"). In 3.0, \u or
\U in a raw string should have no special meaning -- it's just a
backslash followed by 'u' or 'U'.
This was fixed in 3.0a3. It seems to have reverted to the old (2.x)
behavior in 3.0a4.
THIS MUST BE FIXED!
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-3000