[Python-Dev] PEP 3144 review.

Andrew McNamara andrewm at object-craft.com.au
Thu Sep 17 02:30:27 CEST 2009


>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.

Put another way, an "Address" describes a single end-point and a "Network"
describes a set of (contiguous) Addresses.

Where things have become confused is that, for practical reasons, it is
convenient to have a representation for an Address and it's containing
Network (the later can be derived from the Address and a mask). We tried
to make the current Network entity do double-duty, but it is just leading
to confusion.

This is why I proprose there be three entities:

 * an Address entity (same as the current one)
 * a Network entity (like now, but requires masked bits to be zero)
 * an AddressWithMask entity (existing Network, but no container behaviour)

There is a school of thought that says we only need a single class
that behaves like the current Network entity - end-points are simply
represented by an all-ones mask. This is, I think, where we started. But
this scheme was rejected.

-- 
Andrew McNamara, Senior Developer, Object Craft
http://www.object-craft.com.au/


More information about the Python-Dev mailing list