[Python-Dev] timeoutsocket.py

Tim O' Malley tomalley@eink.com
Tue, 16 Apr 2002 11:30:23 -0400


hola.

Regarding timeoutsocket.py:
I would be happy to see timeoutsocket.py in the standard library.
It's been great that people have found timeoutsocket.py to be
useful -- even more so, thrilling that some have found it useful
enough to consider inclusion in the standard library.

Onto questions...

1.  Shall we merge socket.py and timeoutsocket.py?

It certainly is possible to merge TimeoutSocket and _socketobject.
If the merge was done in a straightforward manner, then every TCP
socket would use Python code (instead of C code) for recv() and 
send() methods.  Some might consider this an unacceptable performance
hit.

It may be possible to "trigger" the creation of a timeoutsocket
when the program attempts to set the timeout.  (I say "may" because
I would need to think about what would happen if someone called
makefile() and then tried to set the timeout.)

My first inclination: it is "correct" to unify the two objects
because that would present the most natural interface.  From where
the module is today, however, it might take some thought to do it
right.


2.  If yes to Q1, how are we going to due with the copyright issue?

I would be happy to change the copyright over to PSF.
There should be some way that users of earlier versions of Python
can continue to use timeoutsocket.py, but changing the copyright
shouldn't prevent that. 

3.  If no to Q1, are we going to just add timeoutsocket.py to standard
    library (Though there the copyright issue stays)?

Copyright won't be an issue.

TimO




-----Original Message-----
From: Bernard Yue [mailto:bernie@3captus.com]
Sent: Monday, April 15, 2002 4:38 PM
To: skip@pobox.com
Cc: Guido van Rossum; python-dev@python.org; timo@alum.mit.edu
Subject: Re: [Python-Dev] timeoutsocket.py


Skip Montanaro wrote:

>     >> What is the status of integrating timeoutsocket.py into standard
>     >> library?  Are there any body responsible for it currently?  If not
I
>     >> would like to give it a shot.
>
>     Guido> Isn't one of the problems that the timeout is global?
>
> That's the easiest way to use it, but you can specify timeouts on a
> per-socket basis.  From the module docstring:
>
>     import timeoutsocket
>     import httplib
>     H = httplib.HTTP("www.python.org")
>     H.sock.set_timeout(30)
>
> The author, Tim O'Malley, is probably the best person to address issues
with
> this package, so I've added him to the cc list in case he's not a
python-dev
> subscriber.
>
> Skip

Just have a look at socket.py and timeoutsocket.py (version 1.21, assuming
the
lastest).  Looks like that class _socketobject and class Timeoutsocket can
be
merged with no conflict.

Now it comes the question:

1.  Shall we merge socket.py and timeoutsocket.py?
2.  If yes to Q1, how are we going to due with the copyright issue?
3.  If no to Q1, are we going to just add timeoutsocket.py to standard
library
(Though there the copyright issue stays)?


Bernie

--
In Scotland, a new game was invented. It was entitled
Gentlemen Only Ladies Forbidden.... and
thus the word GOLF entered into the English language.