Re:Python 3 makes it easier to develop high-quality software
by mark-r on Wednesday November 18, 2015 @06:21PM
(#10591486)
The accidental complexity here is due to Windows, not Python. Python would rather generate an error than give you garbled output without your knowledge.
Re:Python 3 makes it easier to develop high-quality software
by vetinari on Thursday November 19, 2015 @02:45AM
(#10593335)
Most 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.
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).