You can replace sys.stdout with your own object that prints to a list of streams.
I have used this in the past.
I think was essentially the OP's suggestion #4:
4. add to the standard io library
a new class which gives you the write interface of a single stream, but
is a wrapper that will write to multiple streams:
Except that it would be in the stdlib. "note very two line function needs to be in the stlib" -- but I'm guessing that there might be some subtleties to make it truly robust, so it may be worth adding.
Also, from a newbie script-writers perspective, that few-line class is a bit complex.
-CHB
Christopher Barker, PhD (Chris)
Python Language Consulting
- Teaching
- Scientific Software Development
- Desktop GUI and Web Development
- wxPython, numpy, scipy, Cython