[Python-Dev] _socket efficiencies ideas

Sean Reifschneider jafo@tummy.com
Wed, 9 Apr 2003 06:48:48 -0600

On Tue, Apr 08, 2003 at 10:50:50AM -0400, Guido van Rossum wrote:
>Are you sure that it tries make a DNS call even when the address is
>pure numeric?  That seems a mistake, and if that's really happening, I

My first thought is that there should be a local DNS cache on the
machine that is running these apps.  My second thought is that Python
could benefit from caching some lookup information...

>address is purely numeric.  I'd be happy to see a patch that
>intercepts addresses of the form \d+\.\d+\.\d+\.\d+ and parses those
>without calling getaddrinfo().

It's not quite that easy.  Beyond the IPV6 issues mentioned elsewhere,
you'd also want to check "\d+.\d+" and "\d+\.\d+\.\d+".  IP addresses
will fill in missing ".0"s, which is particularly handy for accessing
"127.1", which gets expanded to "".

 Rocky: "Do you know what an A-Bomb is?"
 Bullwinkle: "Of course.  ``A Bomb'' is what some people call our show."
Sean Reifschneider, Inimitably Superfluous <jafo@tummy.com>
tummy.com, ltd. - Linux Consulting since 1995.  Qmail, Python, SysAdmin