[Python-Dev] Adding timeout to socket.py and httplib.py

Facundo Batista facundo at taniquetil.com.ar
Tue Mar 20 20:24:30 CET 2007


Alan Kennedy wrote:

> [Facundo]
>> But, I recognize that maybe it's [connect] not the best name. What about
>> "create_connection"?
>
> I have no strong feelings about it, other than to say it should not be
> "connect". How about

Ok. "create_connection", then.


> Ah, but it's too late by the time the socket.connect call returns: the
> timeout/blocking behaviour of the socket.connect call is the very
> thing we're trying to control.

It's not the very thing, just one of them... whatever, you have a point.


> Whereas with the slightly modified API I suggested earlier, it simply becomes

I'm OK with that API, except that you're losing position
parameters. It's OK to *always* need to put the "timeout="? 

The problem here is that I used None to check if you passed a parameter
or not, an idiom well stablished in Python, but in this very case None
has a meaning for itself.

I'm +0 on having the obligation to a named parameter here. 


So, I have two modifications to make to the patch:

- change the name to "create_connection"
- make timeout obligatory named

Is everybody ok with this?

Regards,

-- 
.   Facundo
.
Blog: http://www.taniquetil.com.ar/plog/
PyAr: http://www.python.org/ar/




More information about the Python-Dev mailing list