Paul Prescod <paul@prescod.net> writes: > > 1. Implement the magic comment detection, but only apply the > > detected encoding to Unicode literals in the source file. > > > > If no magic comment is used, Python should continue to > > use the standard [raw-]unicode-escape codecs for Unicode > > literals. > > Are we thinking about Python's unicode literal syntax as just a codec? I > know that there is a codec that implements that syntax but I would hate > to find out that if I use KOI8-R, I no longer have the ability to use \U > in my code to insert Kanji. That will continue to be possible. With an encoding declaration, it is not the "standard" unicode-escape codec anymore. Instead, the string is first decoded into a Unicode object, then again decoded for escapes. The second step is a Unicode->Unicode transformation that will be available only to parser (although there is currently a debate whether to make it share code with the byte->unicode unicode-escape codec). Regards, Martin
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