On Mon, Jun 1, 2009 at 12:16 PM, "Martin v. L÷wis" <martin@v.loewis.de> wrote:
As for Clay McLure's issue: I feel it's primarily a matter of taste.
I see nothing morally wrong in using the same class for hosts and
networks, i.e. representing a host as a network of size 1. I can
understand why people dislike that, but I don't see why it would stop
people from doing with the library what they want to do.

To the extent that Clay is having issues, it's because ipaddr.py is poorly documented, has potentially confusing comments, and he became confused. áLesser issues are that ipaddr.py doesn't work the way he wants and that ip addressing is inherently subtle.

Looking at the code in detail shows that ipaddr.IP/IPv4/IPv6 objects always represent *networks*. áHe wants one particular address out of that network, and that requires using __getitem__ or using IP.ip_ext. Neither is particularly intuitive.

>>> import ipaddr
>>> ip = ipaddr.IPv4('')
>>> ip
>>> ip[0]
>>> ip.ip_ext

This feels much more like poor documentation than wide-ranging conceptual flaws.

I could put this in the tracker, but I'm not sure if that's appropriate.