[Python-ideas] Unify addresses passed to bind() and getaddrinfo()

Giampaolo Rodolà g.rodola at gmail.com
Mon Mar 11 20:20:28 CET 2013

>From http://docs.python.org/3/library/socket.html#example

...when using bind():
HOST = ""                 # Symbolic name meaning all available interfaces

...when using getaddrinfo():
HOST = None             # Symbolic name meaning all available interfaces

I recently got bitten by this difference in that I passed "" (empy
string) to getaddrinfo() and since my DNS server was temporarily down
getaddrinfo() hung indefinitely  (cset where I fixed this:
It took me quite some time to figure out what was wrong as to me ""
has always been an alias for "all interfaces" and didn't know
getaddrinfo() behaved differently than bind() in this regard.
If from getaddrinfo() standpoint "" (empty string) has no particular
meaning I propose to unify the two APIs and make getaddrinfo() assume
"" is an alias for "all interfaces".


--- Giampaolo

More information about the Python-ideas mailing list