for testing and dealing with thread-depend stdout/stderr redirection (__so__ helpfull for embedded debug consoles in gui apps), i wrote a simple lib to create global proxy objects which may point to different objects depending on the context of the call stack.
The whole thing is based on a simple proxy implementation taken from werkzeug and a context managers to handle the current context of that global.
I extracted the proxying bits to a base class
I'ts availiable at http://pypi.python.org/pypi/pyscope and http://bitbucket.org/RonnyPfannschmidt/pyscope/overview/
Im hoping for some input on how to do it better and if something along that lines would be a usefull extension to the stdlib.
Regards Ronny Pfannschmidt