[Python-Dev] PEP 3144 review.
Stephen J. Turnbull
turnbull at sk.tsukuba.ac.jp
Thu Sep 17 21:56:43 CEST 2009
Andrew McNamara writes:
> Conceptually, you sometimes need a bare address, and other times,
> you need an address with an associated network (host interface
> configs, router configs, etc). By AddressWithMask, I really mean
> AddressWithEnoughInformationToDeriveNetworkWhenNeeded. Conveniently,
> IPv4 and IPv6 addressing allows us to derive the network from the
> host
That's precisely the claim I deny. Yes, you can derive the network
*address* from a generic address and a mask. You cannot derive the
*network* that way! Eg, suppose in a routing application you have
class IPv4NetworkWithGateway(IPv4Network):
... oops. You want *the* IPv4Network instance that has all the
gateway info, not just *any* IPv4Network instance that happens to have
the same network address and mask. Address + mask is *not* sufficient
to derive the desired IPv4Network instance.
I grant that sometimes all you really care about is that the network
address and the mask match; constructing on the fly would be
sufficient. However, many of the applications I can think of attach
additional attributes to IPv4Networks, and really do want "the real
thing" vs. a constructed imitation.
More information about the Python-Dev
mailing list