Nick Coghlan added the comment:
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
```
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue29913>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com