[Python-Dev] \u and \U escapes in raw unicode string literals

"Martin v. Löwis" martin at v.loewis.de
Fri May 11 07:41:53 CEST 2007


Greg Ewing schrieb:
> Martin v. Löwis wrote:
>> why should you be able to get a non-ASCII character
>> into a raw Unicode string?
> 
> The analogous question would be why can't you get a
> non-Unicode character into a raw Unicode string.

No, that would not be analogous. The string type in Python
is not an ASCII string type, but a byte string type. It
does not necessarily only hold ASCII characters, but
can (and, in hundreds of applications) does hold arbitrary
bytes. There is (in the non-raw form) support of filling
arbitrary bytes into a byte string literal.

So no, this is not analogous.

Regards,
Martin


More information about the Python-Dev mailing list