[Python-Dev] PEP 3144 review.

Peter Moody peter at hda3.com
Sun Sep 27 04:22:08 CEST 2009


I again invite interested parties to continue this discussion on
ipaddr-py-dev at googlegroups.com.  we're pushing 250 messages on PEP
3144 at this point; well beyond what most folks would call a "long
open-ended discussion".

anyway:

> The current behaviour is confusing to me. For example:
>
>>>> netw1 = ipaddr.IPv4Network('192.168.1.1/24')
>>>> netw2 = ipaddr.IPv4Network('192.168.1.0/24')
>>>> netw1 == netw2
> False
>>>> list(netw1) == list(netw2)
> True

I think you're intentionally confusing yourself here.  192.168.1.1
clearly doesn't equal 192.168.1.0, so I don't know why you'd expect
192.168.1.1/24 to equal 192.168.1.0/24.

> Two networks, containing exactly the same range of addresses, but they
> don't compare equal. I'm not convinced that netw1 should even be
> allowed, but if it is, surely it should be turned into canonical form
> netw2? E.g. I would expect this:
>
>>>> ipaddr.IPv4Network('192.168.1.1/24')
> IPv4Network('192.168.1.0/24')
>
> but that's not what it does.

now you're confusing me as before you've asked for this to either:

 1. Raise an exception
 2. Return two objects.

your unconfusing (to you) example does neither one of those.


> --
> Steven D'Aprano
> _______________________________________________
> 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