verifying type of socket object?

Peter Hansen peter at engcorp.com
Thu Nov 8 22:56:29 EST 2001


Peter Wang wrote:
> 
> in my code, i'd like to verify that i get passed a socket object.
> however, i'm having some trouble figuring out what exactly represents
> the "socket type".  the main problem is that socket.socket() doesn't
> return instances of socket.SocketType:

Have you considered the more Pythonic approach of just using
the object passed in as though it were a socket, and adding 
adequate exception handling to deal with it if it is not, or
even just allow the exception to propagate up to the caller
for it to deal with it?

-- 
----------------------
Peter Hansen, P.Eng.
peter at engcorp.com



More information about the Python-list mailing list