Suppress output to stdout/stderr in InteractiveInterpreter

Dave W. evadeflow at gmail.com
Fri Apr 16 18:46:17 CEST 2010


>>> Don't bother. Replacing sys.stdout is the right thing to do. It
>>> won't interfere with the C++ streams...

>> I'm not so certain. Won't the C++ host app share the same
>> stdin/stdout/stderr file descriptors with the embedded Python
>> interpreter?

> No. Changing the object that the name sys.stdout refers to does
> not swap out the underlying file descriptors.

Whoa--that's a bombshell.  I guess I shouldn't have assumed that
this was the case, but it seemed so 'obvious'.  Glad I was wrong,
since it makes like much, much easier.  Thank you!

[xref "Globally override built-in print function?"]



More information about the Python-list mailing list