R. David Murray wrote:

A network is conventionally represented by an IP address in which the
bits corresponding to the one bits in the netmask are set to zero, plus
the netmask.

Okay, that's clarified things for me, thanks.

In that case, we shouldn't be talking about a "network address"
at all, but just a "network", and it makes sense to have

1) A class called IPNetwork that contains an IP number
and a mask, with the IP number constrained not to have
any ones where the mask has zeroes, and

2) A class called IPAddress which only contains an
IP number.

It seems that some people would also like to have

3) A class called IPAddressWithMask that contains an
IP number and a mask, with no constraints,

but I'm not enough of an expert to know whether such
a thing would be used often enough to be worth having
a special type for it, as opposed to using an
(IPNetwork, IPAddress) pair, or attaching a 'network'
attribute to an IPAddress, or some other solution
when the need arises.

--
Greg
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to