Chris Angelico writes: > But I was surprised to find that Python would let you use > unicode_escape for source code.
I'm not surprised. Today it's probably not necessary, but I've exchanged a lot of code (not Python, though) with folks whose editors were limited to 8 bit codes or even just ASCII. It wasn't frequent that I needed to discuss non-ASCII code with them (that they needed to run) but it would have been painful to do without some form of codec that encoded Japanese using only ASCII bytes. > Maybe the phrase "a small handful" was a bit too hopeful, but would it > be possible to mandate (after, obviously, a deprecation period) that > source encodings be ASCII-compatible? Not sure what you mean there. In the usual sense of ASCII-compatible (the ASCII bytes always mean the corresponding character in the ASCII encoding), I think there are at least two ASCII-incompatible encodings that would cause a lot of pain if they were prohibited, specifically Shift JIS and Big5. (In certain contexts in those encodings an ASCII byte frequently is a trailing byte in a multibyte character.) I'm sure there is a ton of legacy Python code in those encodings in East Asia, some of which is still maintained in the original encoding. And of course UTF-16 is incompatible in that sense, although I don't know if anybody actually saves Python code in UTF-16. It might make sense to prohibit unicode_escape nowadays -- I think almost all systems now can handle Unicode properly, but I don't think we can go farther than that. _______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/ESIU62AXASWUDX7MSAAAAPMTFIDONIAI/ Code of Conduct: http://python.org/psf/codeofconduct/