[Python-ideas] changing sys.stdout encoding
ncoghlan at gmail.com
Thu Jun 7 23:45:55 CEST 2012
The interpreter uses the standard streams internally, and they're one of
the first things created during interpreter startup. User provided code
doesn't start running until well after they're initialised.
If user level code doesn't want those streams, it needs to replace them
with something else.
Sent from my phone, thus the relative brevity :)
On Jun 8, 2012 7:03 AM, "Rurpy" <rurpy at yahoo.com> wrote:
> On 06/07/2012 12:27 AM, Paul Moore wrote:
> > One suggestion, which would probably shed some light on whether this
> > should be viewed as something "simple and reasonable", would be to do
> > some research on how the same task would be achieved in other
> > languages.
> Yes, that is a good idea. If I decide to reraise this
> suggestion at some point, I will try to do as you suggest.
> > I have no experience to contribute but my intuition says
> > that this could well be hard on other languages too.
> Again, I have yet to be convinced this is hard. I am
> very sceptical it is hard in the case of streams before
> they've been written or read. Replacing sys.stdout
> with a wrapper that encodes with the alternate encoding
> clearly works -- it just needs to be encapsulated so the
> user doesn't need to figure out all the details in order
> to use it.
> > Would you be
> > willing to do some web searches to look for solutions in (say) Java,
> > or C#, or Ruby? In theory, it shouldn't take long (as otherwise you
> > can conclude that the solution is obscure to the same extent that it
> > is with Python).
> > Even better, if those other languages do have a simple solution, it
> > may suggest an approach that would be appropriate for Python.
> Python-ideas mailing list
> Python-ideas at python.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-ideas