This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ncoghlan
Recipients Sanjay, ncoghlan, pmoody, xiang.zhang
Date 2017-03-27.09:44:12
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1490607852.65.0.391933003449.issue29913@psf.upfronthosting.co.za>
In-reply-to
Content
Looking into it, this appears to be a holdover from the original ipaddr design where rather than being modelled as separate objects, host interfaces are modelled as denormalised network objects (i.e. a host address with a netmask).

So the stdlib equivalent of the original ipaddr compare_networks() operation would be:

    >>> ip_interface('192.0.2.1/31').network == ip_network('192.0.2.0/31')
True

As Sanjay noted, compare_networks() itself is fairly redundant given the stricter stdlib data model, since we don't allow the creation of denormalised network definitions in the first place:

```
>>> ip_network('192.0.2.1/31')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python3.5/ipaddress.py", line 74, in ip_network
    return IPv4Network(address, strict)
  File "/usr/lib64/python3.5/ipaddress.py", line 1536, in __init__
    raise ValueError('%s has host bits set' % self)
ValueError: 192.0.2.1/31 has host bits set
```
History
Date User Action Args
2017-03-27 09:44:12ncoghlansetrecipients: + ncoghlan, pmoody, xiang.zhang, Sanjay
2017-03-27 09:44:12ncoghlansetmessageid: <1490607852.65.0.391933003449.issue29913@psf.upfronthosting.co.za>
2017-03-27 09:44:12ncoghlanlinkissue29913 messages
2017-03-27 09:44:12ncoghlancreate