Issue 21828: added/corrected containment relationship for networks in lib ipaddress (original) (raw)

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 :

It is useful to quickly determine if a network is a subnet of another