[issue29913] ipadress compare_networks does not work according to documentation

2017-03-30 Thread Xiang Zhang
Changes by Xiang Zhang : -- resolution: -> fixed stage: needs patch -> resolved status: open -> closed ___ Python tracker ___

[issue29913] ipadress compare_networks does not work according to documentation

2017-03-30 Thread Xiang Zhang
Xiang Zhang added the comment: New changeset 16f852345bcdec1bbb15e5363fad6b33bf960912 by Xiang Zhang (s-sanjay) in branch 'master': bpo-29913: deprecate compare_networks() in documentation (GH-865) https://github.com/python/cpython/commit/16f852345bcdec1bbb15e5363fad6b33bf960912 --

[issue29913] ipadress compare_networks does not work according to documentation

2017-03-27 Thread Roundup Robot
Changes by Roundup Robot : -- pull_requests: +765 ___ Python tracker ___

[issue29913] ipadress compare_networks does not work according to documentation

2017-03-27 Thread Sanjay
Sanjay added the comment: ok I will update the doc -- ___ Python tracker ___ ___ Python-bugs-list mailing

[issue29913] ipadress compare_networks does not work according to documentation

2017-03-27 Thread Xiang Zhang
Xiang Zhang added the comment: +1 for the doc change. -- ___ Python tracker ___ ___ Python-bugs-list mailing

[issue29913] ipadress compare_networks does not work according to documentation

2017-03-27 Thread Nick Coghlan
Nick Coghlan added the comment: Right, I agree compare_networks() is behaving correctly according to its original design. However: - it was designed for Python 2, where cmp() style idioms were still more common. Those idioms have largely been removed in Python 3 (no cmp() builtin, no __cmp__

[issue29913] ipadress compare_networks does not work according to documentation

2017-03-27 Thread Xiang Zhang
Xiang Zhang added the comment: I still hold my opinion that the current behaviour is correct. You are comparing two networks and you should count the mask in. And notice that `neta == netb` is not totally equal to `neta.compare_networks(netb)`. The former can only results True or False but

[issue29913] ipadress compare_networks does not work according to documentation

2017-03-27 Thread Nick Coghlan
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

[issue29913] ipadress compare_networks does not work according to documentation

2017-03-27 Thread Sanjay
Sanjay added the comment: yes but compare_networks is not used to implement equality check. __eq__ correctly returns False when we do 1.1.1.0/24 == 1.1.1.0/25. If compare_networks works exactly like __eq__ then it seems a bit redundant. -- ___

[issue29913] ipadress compare_networks does not work according to documentation

2017-03-27 Thread Xiang Zhang
Xiang Zhang added the comment: In my mind this is the wanted behaviour. `compare_networks` means compare one network to another and a network should count its mask in. Your example would look rather weird if 1.1.1.0/24 == 1.1.1.0/25. Maybe make the doc from 'network addresses' to 'network

[issue29913] ipadress compare_networks does not work according to documentation

2017-03-27 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- nosy: +ncoghlan, pmoody ___ Python tracker ___

[issue29913] ipadress compare_networks does not work according to documentation

2017-03-27 Thread Sanjay
Changes by Sanjay : -- pull_requests: +739 ___ Python tracker ___ ___ Python-bugs-list

[issue29913] ipadress compare_networks does not work according to documentation

2017-03-27 Thread Sanjay
New submission from Sanjay: 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 ==