Alas, if it only were that easy. If you write a file descriptor
corresponding to a stdio file, the stdio file's buffering is messed up
unless you do a fflush first. Since the marshal module also requires
a stdio file (for buffering efficiency), it's better if you pass it
the stdio file that's already there. With sockets you can use the
socket's makefile() method (which returns a stdio file corresponding
to the socket).
Anyway, the real solution will be to allow subclassing from built-in
types. Someday...
--Guido van Rossum, CWI, Amsterdam <Guido.van.Rossum@cwi.nl>
URL: <http://www.cwi.nl/cwi/people/Guido.van.Rossum.html>