[Python-Dev] I vote to reject: Adding timeout to socket.py and httplib.py.

Nick Coghlan ncoghlan at gmail.com
Wed Mar 21 12:26:58 CET 2007


Alan Kennedy wrote:
> The proposed new function does not belong in the socket module. In
> contrast to all of the other socket creation and management
> functionality in the socket module, the new function does not handle
> non-blocking IO.

The rest of the socket module isn't going anywhere. If you want to do 
non-blocking IO, don't use the convenience function that is designed for 
use with blocking IO (even better, use a library that makes non-blocking 
IO easier to live with, like asyncore or Twisted).

While the name of the proposed function and it's signature need to 
change (which Facundo has already acknowledged), correctly looking up an 
address and attempting to connect to it is a non-trivial operation, but 
one that is duplicated in several stdlib modules (httplib, poplib, 
ftplib, smtplib at least).

This level of repetition for a dozen line function is insane - Facundo's 
patch is merely the first step towards standardising it.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://www.boredomandlaziness.org


More information about the Python-Dev mailing list