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

Greg Ewing greg.ewing at canterbury.ac.nz
Tue Mar 20 23:18:03 CET 2007


Alan Kennedy wrote:

> def connect(address, **kwargs):
>     [snip]
>             if kwargs.has_key('timeout'):
>                 sock.settimeout(kwargs['timeout'])
>     [snip]

A problem with interfaces like this is that it makes
it awkward to pass on a value that you received from
higher up.

An alternative would be to create and publish a
different special value to mean "no timeout".

--
Greg



More information about the Python-Dev mailing list