2to3?
2to3?
Posted May 30, 2025 21:34 UTC (Fri) by Cyberax (✭ supporter ✭, #52523)In reply to: 2to3? by mb
Parent article: Recent disruptive changes from Setuptools
If you want, I can tell you the tales of DOS vs. DOS Alternative encodings for matrix printers. Or about KOI vs. Win1251 settings for the Linux console fonts.
The problem is that you can't really do anything meaningful with true strings, unless you:
1. Just work within ASCII.
2. Know EXACTLY what you're doing and have enough context information.
The 1. is trivially handled by UTF-8 encoding (ASCII stays ASCII), and it actually covers the majority of needs. And 2. requires you to be aware of the current locale (i->I or i->İ), permissible string splits, invisible characters, LTR switches, etc.
So Python ends up with the disadvantages of both approaches. Python strings are not just bags of bytes, they are some magic black boxes that mere mortals are not supposed to open. Yet they don't provide enough context information to do "interesting" stuff, like being able to correctly split strings at word breaks, or handle case conversion.
