Python 3 is killing Python

Marko Rauhamaa marko at pacujo.net
Wed Jul 16 12:20:14 EDT 2014


Chris Angelico <rosuav at gmail.com>:

> The only thing that might be an issue is that you can't use open(fn)
> to read your files, but you have to explicitly state the encoding.
> That would be an understandable problem, especially for someone who
> develops on a single platform and forgets that the default differs. As
> long as you always explicitly say encoding="utf-8", and document that
> you do so, any problems are someone else's.

Yes. I don't like open() guessing the enconding:

   The default encoding is platform dependent (whatever
   locale.getpreferredencoding() returns)

Also, I don't like sys.std* guessing the encoding:

   Under other platforms, the locale encoding is used (see
   locale.getpreferredencoding()).

In each case, it would have been better to default to bytes just like
subprocess does.


Marko



More information about the Python-list mailing list