Message290566
according to the docs compare_networks only checks the network address but the implementation is also taking the mask length into account. It returns '0' only if both the network address and the mask are equal but this can be done with just equality check ( ip1 == ip2 )
Example:
>>> ip1=ipaddress.ip_network("1.1.1.0/24")
>>> ip2=ipaddress.ip_network("1.1.1.0/25")
>>> ip1.compare_networks(ip2)
-1
>>> ip1 == ip2
False
>>> ip1.network_address
IPv4Address('1.1.1.0')
>>> ip2.network_address
IPv4Address('1.1.1.0')
>>>
shouldn't we ignore the mask length ? I have tried it here:
https://github.com/s-sanjay/cpython/commit/942073c1ebd29891e047b5e784750c2b6f74494a |
|
Date |
User |
Action |
Args |
2017-03-27 07:23:36 | Sanjay | set | recipients:
+ Sanjay |
2017-03-27 07:23:35 | Sanjay | set | messageid: <1490599415.99.0.717154213111.issue29913@psf.upfronthosting.co.za> |
2017-03-27 07:23:35 | Sanjay | link | issue29913 messages |
2017-03-27 07:23:35 | Sanjay | create | |
|