On Mon, 15 Jan 2001, Ka-Ping Yee wrote: > On Mon, 15 Jan 2001, Guido van Rossum wrote: > > Originally, using \x for these was impractical (at least) because of > > the stupid gobble-up-everything-that-looks-like-a-hex-digit semantics > > of the \x escape. Now we've fixed this, I agree. > > Oh, now i understand. Good point. I'll update the patch to do hex. I assume you would like Unicode strings to do the same (\n, \t, \r, and \xff rather than \377). Guido, do you have a Pronouncement on \v, \f, \b, \a? By the way, why do Unicode escapes appear in capitals? >>> u'\uface' u'\uFACE' (If someone tells me that there happens to be a picture of a face at that code point, i'll laugh. Is there a cow at \uBEEF?) Does anyone care that \x will be followed by lowercase and \u by uppercase? I noticed that the tutorial claims Unicode strings can be str()-ified and will encode themselves using UTF-8 as default. But this doesn't actually work for me: >>> us = u'\uface' >>> us u'\uFACE' >>> str(us) Traceback (most recent call last): File "<stdin>", line 1, in ? UnicodeError: ASCII encoding error: ordinal not in range(128) >>> us.encode() Traceback (most recent call last): File "<stdin>", line 1, in ? UnicodeError: ASCII encoding error: ordinal not in range(128) >>> us.encode('UTF-8') '\xef\xab\x8e' Assuming i have understood this correctly, i have submitted a patch to correct tut.tex. -- ?!ng
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4