This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author nikratio
Recipients Marc.Abramowitz, alex, barry, belopolsky, brett.cannon, ezio.melotti, ncoghlan, nikratio, pitrou, rhettinger, vstinner
Date 2013-07-22.05:07:01
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
I think stdout redirection is very useful, and I'm actually have a very similar context manager in my own code.

However, I'd like to raise the question if using a context manager for this purpose should really be "officially blessed" in this way.

To me, the with statement signals that effects are constrained to the managed block. But redirecting sys.stdout is a change with global scope - the redirection is not restricted to execution of the with block, it affects every other thread that's running at the same time. This effect is obvious if you wrote the redirection context manager yourself, but if you're using code from the standard library, this may be surprising.

I don't have a better proposal, but I just wanted to mention this...
Date User Action Args
2013-07-22 05:07:01nikratiosetrecipients: + nikratio, barry, brett.cannon, rhettinger, ncoghlan, belopolsky, pitrou, vstinner, ezio.melotti, alex, Marc.Abramowitz
2013-07-22 05:07:01nikratiosetmessageid: <>
2013-07-22 05:07:01nikratiolinkissue15805 messages
2013-07-22 05:07:01nikratiocreate