diff Lib/_abcoll.py @ 52665:8dff406403be

Issue #5647: MutableSet.__iand__() no longer mutates self during iteration.
author Raymond Hettinger <python@rcn.com>
date Wed, 01 Apr 2009 19:05:50 +0000
parents c4f27e546cf5
children 00ebbf1ce936
line wrap: on
line diff
--- a/Lib/_abcoll.py	Wed Apr 01 18:13:07 2009 +0000
+++ b/Lib/_abcoll.py	Wed Apr 01 19:05:50 2009 +0000
@@ -320,10 +320,9 @@
             self.add(value)
         return self
 
-    def __iand__(self, c: Container):
-        for value in self:
-            if value not in c:
-                self.discard(value)
+    def __iand__(self, it: Iterable):
+        for value in (self - it):
+            self.discard(value)
         return self
 
     def __ixor__(self, it: Iterable):