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: added/corrected containment relationship for networks in lib ipaddress
Type: behavior Stage:
Components: Library (Lib) Versions: Python 3.1, Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 2.7
process
Status: closed Resolution: duplicate
Dependencies: Superseder:
Assigned To: Nosy List:
Priority: normal Keywords: patch

Created on 2014-06-23 12:37 by nlm, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
ipaddress-network-containment.diff nlm, 2014-06-23 12:37 proposed patch review
Messages (1)
msg221350 - (view) Author: Nicolas Limage (nlm) Date: 2014-06-23 12:37
The current version of the ipaddress library implements containment relationship in a way that a network is never contained in another network :

>>> from ipaddress import IPv4Network,IPv4Address
>>> IPv4Network(u'192.168.22.0/24') in IPv4Network(u'192.168.0.0/16')
False

I think it would be better to define the containment relationship between networks as such :

- if network A contains all the ip addresses of network B, then B in A is True
- by extension of this rule, A in A is True

It is useful to quickly determine if a network is a subnet of another
History
Date User Action Args
2022-04-11 14:58:05adminsetgithub: 66027
2014-06-23 12:40:25nlmsetstatus: open -> closed
nosy: - nlm
resolution: duplicate
2014-06-23 12:37:41nlmcreate