Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions Lib/ipaddress.py
Original file line number Diff line number Diff line change
Expand Up @@ -677,8 +677,7 @@ def __contains__(self, other):
# dealing with another address
else:
# address
return (int(self.network_address) <= int(other._ip) <=
int(self.broadcast_address))
return other._ip & self.netmask._ip == self.network_address._ip

def overlaps(self, other):
"""Tell if self is partly contained in other."""
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
improve performance of ``IPNetwork.__contains__()``