Escape sequence "\xhh.." not yet implemented??

June Kim junaftnoon at nospamplzyahoo.com
Tue Nov 14 20:18:35 EST 2000


Yet another discordance from "What's New in Python 2.0":
http://www.python.org/2.0/new-python.html#SECTION000500000000000000000

[quote]
In Python source code, Unicode strings are written as u"string". Arbitrary
Unicode characters can be written using a new escape sequence, \uHHHH, where
HHHH is a 4-digit hexadecimal number from 0000 to FFFF. The existing \xHHHH
escape sequence can also be used, and octal escapes can be used for
characters up to U+01FF, which is represented by \777
[end of quote]

\xHHHH does not work in Python 2.0. It is treated as "\xHH"+"HH".


"June Kim" <junaftnoon at nospamplzyahoo.com> wrote in message
news:8uslua$pfb$1 at news.nuri.net...
> According to the current Python Reference Manual:
> http://www.python.org/doc/current/ref/strings.html#l2h-17
>
> [quote]
> In strict compatibility with Standard C, up to three octal digits are
> accepted, but an unlimited number of hex digits is taken to be part of the
> hex escape (and then the lower 8 bits of the resulting hex number are used
> in 8-bit implementations).
> [end of quote]
>
> The table just above that sentence also indicates obviously that "\x"
> sequence can go on unlimitedly -- it is '\xhh...' implying
> some-more-to-come.
>
> However, to my disappointment, the current Python 2.0 final doesn't work
> that way; it takes only two letters after \x just like old Python did.
>
> >>> '\xA0A0'
> '\240A0'
>
> Is it a discordance btw the manual and the implementation, or my
> misinterpretationt?
>
> --
> June
>
> ps. btw, I don't understand the last bit in the parentheses.
>




More information about the Python-list mailing list