[Python-Dev] \u and \U escapes in raw unicode string literals
M.-A. Lemburg
mal at egenix.com
Thu May 10 21:07:14 CEST 2007
On 2007-05-10 20:53, Paul Moore wrote:
> On 10/05/07, Guido van Rossum <guido at python.org> wrote:
>> I just discovered that, in all versions of Python as far back as I
>> have access to (2.0), \uXXXX escapes are interpreted inside raw
>> unicode strings. Thus:
> [...]
>> Does anyone remember why it is done this way? The reference manual
>> describes this behavior, but doesn't give an explanation:
>
> My memory is so dim as to be more speculation than anything else, but
> I suspect it's simply because there's no other way of including
> characters outside the ASCII range in a raw string.
This is per design (see PEP 100) and was done for the reason given
by Paul. The motivation for the chosen approach was to make Python's
raw Unicode strings compatible to Java's raw Unicode strings:
http://java.sun.com/docs/books/jls/second_edition/html/lexical.doc.html
--
Marc-Andre Lemburg
eGenix.com
Professional Python Services directly from the Source (#1, May 10 2007)
>>> Python/Zope Consulting and Support ... http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/
________________________________________________________________________
:::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! ::::
eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48
D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
Registered at Amtsgericht Duesseldorf: HRB 46611
More information about the Python-Dev
mailing list