summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2002-08-26 00:44:07 +0000
committerTim Peters <tim.peters@gmail.com>2002-08-26 00:44:07 +0000
commit29382cfc5fb4eea69c36064c936b2596bf04c59e (patch)
tree1215b07389f51d9be2e216df3f3d7d1a0ebeaa7f
parent3198c2abefb83d40d64bf873f55b782074e7a042 (diff)
downloadcpython-29382cfc5fb4eea69c36064c936b2596bf04c59e.tar.gz
Gave intersection_update a speed boost.
-rw-r--r--Lib/sets.py4
1 files changed, 1 insertions, 3 deletions
diff --git a/Lib/sets.py b/Lib/sets.py
index e33464b58e..5007709979 100644
--- a/Lib/sets.py
+++ b/Lib/sets.py
@@ -380,9 +380,7 @@ class Set(BaseSet):
def __iand__(self, other):
"""Update a set with the intersection of itself and another."""
self._binary_sanity_check(other)
- for elt in self._data.keys():
- if elt not in other:
- del self._data[elt]
+ self._data = (self & other)._data
return self
def intersection_update(self, other):