[Python-Dev] Go \x yourself

Tim Peters tim_one@email.msn.com
Fri, 4 Aug 2000 05:26:29 -0400


[Tim Peters]
> >>> "\x123465" # \x12 -> \022, "3456" left alone
> '\0223456'
> >>> "\x65"
> 'e'
> >>> "\x1"
> ValueError
> >>> "\x\x"
> ValueError
> >>>

[?!ng]
> I'm quite certain that this should be a SyntaxError, not a
> ValueError:
>
>     >>> "\x1"
>     SyntaxError: two hex digits are required after \x
>     >>> "\x\x"
>     SyntaxError: two hex digits are required after \x
>
> Otherwise, +1.  Sounds great.

SyntaxError was my original pick too.  Guido picked ValueError instead
because the corresponding "not enough hex digits" error in Unicode strings
for damaged \u1234 escapes raises UnicodeError today, which is a subclass of
ValueError.

I couldn't care less, and remain +1 either way.  On the chance that the BDFL
may have changed his mind, I've copied him on this msg,  This is your one &
only chance to prevail <wink>.

just-so-long-as-it's-not-XEscapeError-ly y'rs  - tim