On Tue, 15 Sep 2009 at 14:16, Scott Dial wrote: > In other words, I don't see why obtaining a host address would *not* > retain the hostmask from the network it was obtained from. I am not > disagreeing with it being an individual address. I am disagreeing that > IPNetwork itself already does represent individual addresses (hence my > aliasing it with IPAddressWithNetwork). And wrt, the logical return > would be another IPAddressWithNetwork retaining the same mask. In other other words, maybe we have three data types: IPv4Address IPv4AddressWithMask IPv4Network Where myAddressWithMask.network would return an IPv4Network object, and an IPv4Network object would always have the zero of the network as its representation: x = IPv4AddressWithMask('192.168.1.1/24') x.network == IPv4Network('192.168.1.0/24') x.network[1] == x In this scheme, IPv4Network('192.168.1.1/24') would raise a ValueError. Although you could probably have what I called IPv4AddressWithMask be called IPv4Address, and have what is now IPv4Address just have netmask and network attributes of None. If this were done, I would expect IPv4Network.network to be either an attribute error or return self. --David
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4