[Python-Dev] _socket efficiencies ideas

"Martin v. Löwis" martin@v.loewis.de
Wed, 09 Apr 2003 20:49:54 +0200


Marcus Mendenhall wrote:

> The getsockaddr call uses them (actually the correct name for one of the 
> flags is AI_NUMERICHOST, not AI_NUMERIC as I originally stated), and its 
> part of the BSD sockets library, which is basically what the python 
> socketmodule wraps.

More importantly, it is part of RFC 2553, which Python uses; it is also
part of Winsock2.

> I guess intercepting all numeric is OK, it is just less efficient (since 
> it requires a trial parsing of an address, which is wasted if it is not 
> all numeric), and because it is so easy to implement <numeric>.  

But isn't the same trial parsing needed to determine presence of the 
"<numeric>" flag? The trial parsing Guido proposes usually stops with
the first letter in a non-numeric address, and accesses up to 16 letters
for a numeric address.

Regards,
Martin