]> granicus.if.org Git - python/commitdiff
Gave intersection_update a speed boost.
authorTim Peters <tim.peters@gmail.com>
Mon, 26 Aug 2002 00:44:07 +0000 (00:44 +0000)
committerTim Peters <tim.peters@gmail.com>
Mon, 26 Aug 2002 00:44:07 +0000 (00:44 +0000)
Lib/sets.py

index e33464b58e232df052de4448e2d73890022c8f91..5007709979ebd32ce3537668746ee2c998055946 100644 (file)
@@ -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):