[Python-Dev] [patch #100912] should we keep the \xnnnn escape in unicode strings?

Tim Peters tim_one@email.msn.com
Sun, 16 Jul 2000 14:24:56 -0400


[/F]
>     for maximum compatibility with 8-bit strings and SRE,
>     let's change "\x" to mean "binary byte" in unicode string
>     literals too.
>
> I've prepared a small patch.  If nobody objects, I'll check
> it in next weekend, or so...
>
> [patch 100912]

[MAL]
> There were objections from Finn Bock and myself: \xXXXX is
> defined to mean "read all hex chars until the next non-hex char
> and then cast to the underlying type (char or wchar_t)" in C9X.

Python and C9X are different languages -- Python isn't obligated to ape
C9X's backward-compatibility hacks.

> Don't know about Java... Finn ?

Java doesn't have \x notation, period -- Java isn't insane <wink>.  Finn was
talking about JPython's attempts to make sense of Python's \x notation.

> Not that this definition is optimal, but we should stick to what
> the standard says ...

Why?  It's a standard for a different language.  Most of what C9X says about
\x boils down to "implementation-defined" anyway, and that's unPythonic on
the face of it.