drkjam/netaddr — pull request #42 by snordhausen (2013-02-07 10:53:46+00:00)
Title: Even more performance, extended __contains__

The __contains__ methods have been heavily restructured. Overall, performance improved as a result, although the heavy usage of isinstance probably makes some specific calls a tad slower. Thanks to those calls, though, __contains__ gains a new feature: Using
"10.0.0.42" in IPNetwork("10.0.0.0/24")
is now possible, which is probably a use case that many people have.

The rest is the usual algorithm optimization / replacement.
IPSet.issuperset/issubset now run in O(n) time with O(1) space, which used to be O(n*log(n)) time and O(n) space. That has become possible because IPSet.__contains__ is now O(1) instead of O(n). Without that, the new implementations of issuperset/issubset would run in O(n^2) time.