"Steven Bethard" <[EMAIL PROTECTED]> wrote:
> On 3/20/07, Facundo Batista <[EMAIL PROTECTED]> wrote:
> > 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?
> 
> FWLIW, +1.  It was not immediately apparent to me that the third argument in::
> 
>     newsock = socket.create_connection(HOST, PORT, None)
> 
> is supposed to be a timeout.  The modified version::
> 
>     newsock = socket.create_connection(HOST, PORT, timeout=None)
> 
> is much clearer to me.

Agreed, though implementation-wise, there is another technique for
determining whether the use provided an argument to timeout or not...

sentinel = object()

def connect(HOST, PORT, timeout=sentinel):
    ...
    if timeout is not sentinel:
        sock.settimeout(timeout)
    ...

A keyword argument via **kwargs is also fine.  I have no preference.


 - Josiah

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to