Subclassing socket

Pelmen pelmenmail at mail.ru
Wed Dec 21 07:25:06 CET 2005


imho:
class new_socket(socket):
    def __init__(self, family=AF_INET, type=SOCK_STREAM, proto=0,
_sock=None)
       socket.__init__(self, family=AF_INET, type=SOCK_STREAM, proto=0,
_sock=None)

    def accept( self ):
        conn, addr = socket.accept()
       return ( new_socket(_sock=conn), addr )

but i think your problem have a more simple way then inheritance




More information about the Python-list mailing list