A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2007-March/072164.html below:

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

[Python-Dev] Adding timeout to socket.py and httplib.pyJosiah Carlson jcarlson at uci.edu
Wed Mar 21 00:10:23 CET 2007
"Alan Kennedy" <python-dev at alan.kennedy.name> wrote:
> 
> [Facundo]
> > Letting "timeout" be positional or named, it's just less error prone.
> > So, if I can make it this way, it's what I prefer, :)
> 
> So, if I want a timeout of, say, 80 seconds, I issue a call like this
> 
> new_socket = socket.create_connection(address, 80)
> 
> So is that address = host, port = 80?
> 
> Or is it address = (host, port), timeout=80?
> 
> I know *we* know what it is, but will the user?
> 
> I prefer explicit naming of the timeout parameter.

Error-wise, I agree that it would be better to pass timeout explicitly
with a keyword, but generally users will notice their mistake if they
try to do create_connection(host, port) by ValueError("tuple expected as
first argument, got str instead") Is it better than
TypeError("create_connection takes 1 argument (2 given)") ?


 - Josiah

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4