[Python-ideas] changing sys.stdout encoding
Stephen J. Turnbull
stephen at xemacs.org
Thu Jun 7 09:12:26 CEST 2012
Rurpy writes:
> I took the time to post here because it took an inordinate
> amount of effort to find a solution to a legitimate need
> (your opinion to the contrary not withstanding)
I don't think I said the need was illegitimate, if I did I apologize,
and I certainly don't believe it is (I'm an economist by trade -- de
gustibus non est disputandum).
I just don't think it's necessary for Python to try to address the
problem, because the problem is somebody else's bad design at root.
And I don't think it would be wise to try to do it in a very general
way, because it's very hard to do that at the general level of the
language.
> I understand there is no support here for providing a non-
> obscure, programmatic way of changing the encoding of the
> standard streams at program startup
You're wrong. There is *some* support for that.
It just has to be done safely, and that means that a generic
.set_encoding() method that can be called after I/O has been performed
probably isn't going to happen.
And it might not happen at the core level, since a 3-line function can
do the job, it might make just as much sense to put up a package on
PyPI.
More information about the Python-ideas
mailing list