4 ms·
Python 3 is okay-ish for developers who don't think about encodings unless forced to, but it actually makes it more difficult to do "the right thing": http://l
by yepguy 11y ago
Python 3 is okay-ish for developers who don't think about encodings unless forced to, but it actually makes it more difficult to do "the right thing":
http://lucumr.pocoo.org/2014/5/12/everything-about-unicode/ http://lucumr.pocoo.org/2014/5/12/everything-about-unicode/
- vetinari 11y agoHaving to thing about encoding all the time, without being forced to, brings in a lot of unwanted accidental complexity. Did you know, that there is an operating system, where a simple loop that reads lines from file and prints them to the console will end up with errors? (that being Windows and some European code pages, where console is cp85x, filesystem read and write cp125x).
- mark-r 11y agoThe accidental complexity here is due to Windows, not Python. Python would rather generate an error than give you garbled output without your knowledge.
- vetinari 11y agoMost developers are not aware of that and write code, that just bombs out for the user. The user would prefer at least garbled text instead of exception, because he is used to that anyway in other apps. He has at least some result, instead of stack trace. Well, and that's before the user tries to redirect stdout to file, in which case it will end up with error too, because that is going to be 7-bit ascii. Anyway, Python3 does the right thing with defining the encoding at the edges and everything works right for the user out of the box.