[Python-ideas] Python 3 open() text files: make encoding parameter optional for cross-platform scripts

Stephen J. Turnbull stephen at xemacs.org
Sun Jun 9 18:18:41 CEST 2013


Yuval Greenfield writes:

 > Personally I favor the first because more often than not files
 > aren't encoded in the platform's chosen encoding, so it's better to
 > be explicit and consistent.

I've been doing development of multilingual and multiscript software
for two decades.  As much as I'd like to agree with you, in my
experience you're wrong by a large factor where it matters: text files
where there's an issue of "guessing" the encoding.  Those are far more
often than not encoded in the platform's default encoding.

If there's no guessing involved, then explicitly specifying the known
encoding is an inconvenience, indeed.  But is it really that big an
inconvenience?  



More information about the Python-ideas mailing list