[Python-Dev] sys.__stdout__ - was RE: [Idle-dev] Doc Commentary

Gordon McMillan gmcm@hypernet.com
Wed, 25 Oct 2000 20:39:14 -0400


> [Guido]
> 
> > Where did you get this idiom?  You should never use sys.__stdout__
> > this way!  The proper idiom is
> >
> >   save_stdout = sys.stdout
> >   try:
> >       sys.stdout = f
> >       # do some stuff
> >   finally:
> >       sys.stdout = save_stdout
[Mark]
> So what _is_ it intended for?

A fail-safe. The recommended idiom might also be called 
"plays well with others"; a barbarian notion that fortunately has 
not infected most import hacks or program exits...

works-for-me-so-buzz-off-ly y'rs

- Gordon