Message 60627 - Python tracker (original) (raw)

sys.stdout is quite often abused (two independent sightings on c.l.py yesterday): people use it to restore stdout instead of saving the previous stdout.

The real intended use for stdout isn't all that clear (I keep wondering myself why it's there in the first place; its use case must be quite obscure), but more importantly I think the sys docs should contain a warning that stdout is not suitable to restore sys.stdout after redirection.

I'd produce a patch if I knew how to better describe what sys.stdout was for.