Closed bewing closed 9 years ago
Thank you for the report! I can reproduce the problem; when I adapted the code from Python 3, __contains__
wasn't yet implemented for networks in networks. I'm looking into resyncing and getting all of the new features.
Actually, looking at the latest 3.5 beta, it looks like not even the upstream does this correctly. from the class _BaseNetwork:
def __contains__(self, other):
# always false if one is v4 and the other is v6.
if self._version != other._version:
return False
# dealing with another network.
if isinstance(other, _BaseNetwork):
return False
Looks like upstream is also tracking this issue: http://bugs.python.org/issue20825
See the upstream discussion: in
will just check for elements, not subsets.
In ipaddress 1.0.9, I've already applied the upstream patch, you can now use subnet_of
/ supernet_of
.
Unable to test if a subnet/network is wholly contained within another -- all comparisons return false: