Right now the dis module uses print to output. This restricts it's use to interactive. You can't easily route the output to files, webpages, run re's on it, etc. This patch just adds an optional keyword parameter write that defaults to sys.stdout.write and replaces print statments with calls to write.
Logged In: YES user_id=80475 Tim, there is a similar patch for pdb.py at <www.python.org/sf/721464>. Like Anthony's patch to cmd.py, I think it has a valid use case and should go in. Knowing why cmd.py was accepted and why dis.py was rejected, what do you think about pdb.py?
Logged In: YES user_id=31435 Sorry, I don't have an opinion about pdb -- I've hardly ever used it. Do what you think is best, and Guido will hit you if he disagrees .
Logged In: YES user_id=699438 Basically, Guido was -1 saying you can redirect sys.stdout and no one else cared one way or the other. So it wasn't an outright rejection, more lack of interest. In my particular case, I was routing the output to a webserver, and was concerned about the thread safety of temporarily redirecting sys.stdout to a socket. After I sumbitted, I also realized I missed passing the write parameter into one of the calls. It should be easy to find but if you want a good patch let me know.