Freek Dijkstra added the comment:

A bit odd questions: What is the is_private() function intended to accomplish?

I have been wondering what is_private() means, and how users of the library are 
going to use this function. I've actually failed to come up with any sensible 
use-case with the current implementation. So in the current state, without the 
modifications, my vote would be to remove the method, as it is more likely to 
add confusion than the be of a particular use.

The most useful method (which I originally thought it was meant to do) is a 
function that indicates if a certain IP range is NATted (only an indication, 
since it requires a network to reliable test). However, that's not what the 
current function entails: it misses the 100.64.0.0/10 range, which is NATted, 
but includes the fc00::/7 unique local block, which is not NATted.

I would be all in favour of such a is_natted() function, but that's not what 
this is.

The is_private() function also does not simply list "private" IP addresses, 
when looking at the formal IETF definitions, since it includes fc00::/7, which 
are unique local addresses, which in practice used in a rather different way: 
IPv4 private IP addresses are often NATted (and routed after translation), 
while IPv6 unique local addresses are typically used for local non-routed 
networks.

Also, the is_private() function does not list all non-globally assigned 
addresses. That should includes a lot more ranges, as listed on 
http://www.iana.org/assignments/iana-ipv4-special-registry/iana-ipv4-special-registry.xhtml
 and 
http://www.iana.org/assignments/iana-ipv6-special-registry/iana-ipv6-special-registry.xhtml.

So far, the is_private() function seems to return True for addresses which are:
* non-globally assigned (as opposed to regular unicast and multicast addresses)
* available for manual assignment (as opposed to link-local addresses)
* may be assigned by end-sites, but not by ISPs (as opposed to shared IP 
addresses and the small DS-Lite block)
* is not intended for benchmarking purposes (as opposed to benchmarking IP 
addresses)

Frankly, I wonder if this very particular information of enough interest to 
warrant a function on its own.

In that case, I much rather see more generic (and hopefully more useful) 
functions such as is_natted() and for is_global(), is_forwardable() and 
is_reserved(), as defined by IANA.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue17400>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to