[Python-Dev] PEP 3144 review.

Peter Moody peter at hda3.com
Thu Sep 17 02:58:25 CEST 2009


On Wed, Sep 16, 2009 at 5:30 PM, Andrew McNamara
<andrewm at object-craft.com.au> wrote:
>>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)

This proposal actually leads to 6 entities (3 for IPv4 and 3 for IPv6).

It's still unclear to me what is gained by pulling AddressWithMask
functionality out of the current network classes. It's easy enough for
the concerned developer who to check if the entered network address
does actually have all of its host bits set to zero. It is not my
experience that this behavior is desired so often that having the
network classes behave as they do now leads to a great deal of
confusion.

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

I don't think anything has actually been rejected.

> --
> Andrew McNamara, Senior Developer, Object Craft
> http://www.object-craft.com.au/
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: http://mail.python.org/mailman/options/python-dev/python-dev%40hda3.com
>


More information about the Python-Dev mailing list