[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 02:08:19 CEST 2013


MRAB writes:

 > What I meant was that I'd prefer it to default to an encoding that was
 > the same on all platforms, not whatever encoding _this_ machine happens
 > to be using, which might be different from whatever encoding _that_
 > machine happens to be using.
 > 
 > Or, in summary, I think that portability is more important.

No, you think that it would be more convenient for you if you didn't
have to specify UTF-8 because that's often what you want, and would
like to impose that decision on people whose needs are *manifestly*
different from yours.  It's *obvious* that their needs are different
because they have a default encoding different from UTF-8.

And even if that's an historical accident, backward compatibility with
existing texts is a real need for them.  On several occasions
(including PEP 263, where I took a position similar to yours, and was
wrong), within-system compatibility has been opposed to across-system
compatibility.  The former won each time.  It's not an entirely
satisfactory compromise, but it really was the best default policy.

I don't see that has changed, except that the number of systems where
the two conflict has decreased.  Still, on those systems, within-
system compatibility by default is the better choice.  If it weren't,
the systems' admins should be convinced to change their default.



More information about the Python-ideas mailing list