[Python-Dev] sys.__stdout__

Guido van Rossum guido@python.org
Wed, 25 Oct 2000 23:02:11 -0500


> So what _is_ it intended for?

Example: IDLE redirects sys.stderr so that it gets displayed in the
Python Shell window with a different text color.  But occasionally I
need to debug IDLE and the bug is in the text drawing.  Then it's nice
if I can write to __stderr__, which goes to the console.

Or suppose I'm in a regular interactive session and I've managed to
screw myself by assigning a bogus file object to sys.stdout (it
happens :-).  If I know that, I can type sys.stdout = sys.__stdout__
at the >>> prompt and save myself -- so I don't have to restart the
session and perhaps lose valuable data.

--Guido van Rossum (home page: http://www.python.org/~guido/)