peter at engcorp.com
Thu Aug 26 07:16:10 CEST 2004
Jay Donnell wrote:
> I don't understand the inner workings of the socket or timeoutsocket
> modules. On it's face it doesn't make sense that importing
> timeoutsocket would magically override the behaviour of socket without
> me doing anything else to the socket module. This appears to be what
> happens, but it certainly isn't clear to someone that doesn't know how
> it works. Here is what timeoutsocket says, "After this module
> has been imported, all socket creation goes through this shim. ".
> After reading this I was unsure if I needed to install
> timeoutsocket.py into the base python distro because, again, it seems
> odd that simply dropping timeoutsocket.py into my cwd and importing it
> will override the behaviour of the socket module. This didn't say
> "exactly what I need to do".
Yes it does. It may seem odd, but it does in fact say something
that is exactly what you should do.
> It assumed a few things that seemed odd
> to me. How does timeoutsocket.py " insert a shim into the socket
> module."? What does that mean??? It wasn't clear! In the time it took
> you and the other guy to criticize me you could have simply said,
> "yeah, just drop it into your cwd and import it".
Just because you disbelieved the words doesn't mean they aren't
clear. Maybe it should say "do this... it works, really!". Would
that have helped?
Anyway, in the time it took us all to have this discussion, you
could really easily have just tried it and seen for yourself
that it did work. Python has a nice interactive interpreter
prompt just for such things, and it's good to get in the habit
of using it.
> P.S. - I really do appreciate the help that Benjamin gave.
And yet he says he didn't know how it worked either, but you
believed him and not the comments in the code itself. I can
see that despite anything any of us say about the inadequacy
of the approach you took you are right and we're wrong. Carry
More information about the Python-list