Gave intersection_update a speed boost.

This commit is contained in:
Tim Peters 2002-08-26 00:44:07 +00:00
parent cd06eeb20c
commit 454602f0f7
1 changed files with 1 additions and 3 deletions

View File

@ -380,9 +380,7 @@ class Set(BaseSet):
def __iand__(self, other): def __iand__(self, other):
"""Update a set with the intersection of itself and another.""" """Update a set with the intersection of itself and another."""
self._binary_sanity_check(other) self._binary_sanity_check(other)
for elt in self._data.keys(): self._data = (self & other)._data
if elt not in other:
del self._data[elt]
return self return self
def intersection_update(self, other): def intersection_update(self, other):