[IPython-dev] IPython with Color on windows

Gary Bishop gb at cs.unc.edu
Sat May 24 17:27:47 CDT 2003


Option 1 would not require changing sys.stdout. I wouldn't want to do 
that. It would work just like option 2 except instead of passing 
arguments, you import a module with the info. I'd do something like a 
module "ConsoleFilter" with a variable "ConsoleOut".

Now any module that wants to output to the console, just

from ConsoleFilter import ConsoleOut

print >>ConsoleOut, whatever

instead of

print whatever

The ConsoleFilter (or whatever) module takes care of initializing 
"ConsoleFilter" based on the OS and available modules, etc.

Very minimal changes to the current structure and the change is nicely 
encapsulated in the "terminal" module.

See what I mean? It would be much easier (for me at least) to implement 
than 2 which requires changing every place in the call chain to provide 
the object.

gb




More information about the IPython-dev mailing list