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.

classification
Title: ipaddress ver. 1.0.14 IPv4Network off by 1
Type: Stage: resolved
Components: Versions: Python 2.7
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: kghongaku, xiang.zhang
Priority: normal Keywords:

Created on 2017-05-19 21:34 by kghongaku, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (5)
msg293978 - (view) Author: kelly hirai (kghongaku) Date: 2017-05-19 21:34
for x in ipaddress.IPv4Network(u"192.168.0.0/23").hosts():
    print x

contains 192.168.1.0 but does not contain 192.168.1.255

ipaddress version 1.0.14
msg293980 - (view) Author: kelly hirai (kghongaku) Date: 2017-05-19 22:12
tested with 1.0.18 with same results.
msg293991 - (view) Author: Xiang Zhang (xiang.zhang) * (Python committer) Date: 2017-05-20 02:02
See the doc: https://docs.python.org/3/library/ipaddress.html#ipaddress.IPv4Network.hosts. For hosts() method, network address and broadcast address are excluded from the result. So it's right IPv4Address('192.168.0.0') and IPv4Address('192.168.1.255') are not included.
msg294254 - (view) Author: kelly hirai (kghongaku) Date: 2017-05-23 15:04
i thought it was inconsistent that
192.168.1.0 was included, but 192.168.0.0 was not.
msg294321 - (view) Author: Xiang Zhang (xiang.zhang) * (Python committer) Date: 2017-05-24 05:08
"192.168.0.0" is the network address of "192.168.0.0/23" while "192.168.1.0" not. :-)
History
Date User Action Args
2022-04-11 14:58:46adminsetgithub: 74592
2017-05-24 05:08:08xiang.zhangsetmessages: + msg294321
2017-05-23 15:04:52kghongakusetmessages: + msg294254
2017-05-20 02:02:34xiang.zhangsetstatus: open -> closed

nosy: + xiang.zhang
messages: + msg293991

resolution: not a bug
stage: resolved
2017-05-19 22:12:49kghongakusetmessages: + msg293980
2017-05-19 21:34:42kghongakucreate