New submission from Nicolas Limage:

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

----------
components: Library (Lib)
files: ipaddress-network-containment.diff
keywords: patch
messages: 221350
nosy: Nicolas.Limage
priority: normal
severity: normal
status: open
title: added/corrected containment relationship for networks in lib ipaddress
type: behavior
versions: Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4, Python 3.5
Added file: http://bugs.python.org/file35737/ipaddress-network-containment.diff

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue21828>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to