Issue #5647: MutableSet.__iand__() no longer mutates self during iteration.

This commit is contained in:
Raymond Hettinger 2009-04-01 18:50:56 +00:00
parent 449b7d95d4
commit 66c4a6b51c
3 changed files with 30 additions and 4 deletions

View file

@ -286,10 +286,9 @@ class MutableSet(Set):
self.add(value)
return self
def __iand__(self, c):
for value in self:
if value not in c:
self.discard(value)
def __iand__(self, it):
for value in (self - it):
self.discard(value)
return self
def __ixor__(self, it):