Just a slight rant, I think I can find a workaround. I wanted to trace all the output being sent through a socket:
from socket import * sock = socket() socket.connect((host, post)) socket.send('hello over there\n') # I want to log the string Sounds like a job for new style classes: class wsocket(socket): def send(self, msg): print 'socket sending (%s)'% repr(msg) socket.send(msg) sock = wsocket() sock.connect(...) # other stuff same as before However, my print statement never got run. After much head scratching it turns out that the library socket class really makes a wrapper for an internal _socket.socket object. It goes and manually sets the send and recv instance variables to the ones from the _socket.socket, and does similar things for some other methods and the doc strings. It seems to me that the socket module itself should be rewritten to use new style classes, so that socket.socket objects can extend _socket.socket instead of wrapping them. Am I missing something? -- http://mail.python.org/mailman/listinfo/python-list