summaryrefslogtreecommitdiffstats
path: root/Lib/_abcoll.py
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2008-01-31 14:31:45 (GMT)
committerChristian Heimes <christian@cheimes.de>2008-01-31 14:31:45 (GMT)
commit7b3ce6a17ea70e2acec46122e134097ce03d044a (patch)
tree51c11d64bc07786b0e1f9d5a8aaf8336a62a8d66 /Lib/_abcoll.py
parent4b8db419c278215ac1c79f4aac2b1453b13e8c83 (diff)
downloadcpython-7b3ce6a17ea70e2acec46122e134097ce03d044a.zip
cpython-7b3ce6a17ea70e2acec46122e134097ce03d044a.tar.gz
cpython-7b3ce6a17ea70e2acec46122e134097ce03d044a.tar.bz2
Merged revisions 60441-60474 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r60441 | christian.heimes | 2008-01-30 12:46:00 +0100 (Wed, 30 Jan 2008) | 1 line Removed unused var ........ r60448 | christian.heimes | 2008-01-30 18:21:22 +0100 (Wed, 30 Jan 2008) | 1 line Fixed some references leaks in sys. ........ r60450 | christian.heimes | 2008-01-30 19:58:29 +0100 (Wed, 30 Jan 2008) | 1 line The previous change was causing a segfault after multiple calls to Py_Initialize() and Py_Finalize(). ........ r60463 | raymond.hettinger | 2008-01-30 23:17:31 +0100 (Wed, 30 Jan 2008) | 1 line Update itertool recipes ........ r60464 | christian.heimes | 2008-01-30 23:54:18 +0100 (Wed, 30 Jan 2008) | 1 line Bug #1234: Fixed semaphore errors on AIX 5.2 ........ r60469 | raymond.hettinger | 2008-01-31 02:38:15 +0100 (Thu, 31 Jan 2008) | 6 lines Fix defect in __ixor__ which would get the wrong answer if the input iterable had a duplicate element (two calls to toggle() reverse each other). Borrow the correct code from sets.py. ........ r60470 | raymond.hettinger | 2008-01-31 02:42:11 +0100 (Thu, 31 Jan 2008) | 1 line Missing return ........ r60471 | jeffrey.yasskin | 2008-01-31 08:44:11 +0100 (Thu, 31 Jan 2008) | 4 lines Added more documentation on how mixed-mode arithmetic should be implemented. I also noticed and fixed a bug in Rational's forward operators (they were claiming all instances of numbers.Rational instead of just the concrete types). ........
Diffstat (limited to 'Lib/_abcoll.py')
-rw-r--r--Lib/_abcoll.py18
1 files changed, 6 insertions, 12 deletions
diff --git a/Lib/_abcoll.py b/Lib/_abcoll.py
index 4ce3df4..005f437 100644
--- a/Lib/_abcoll.py
+++ b/Lib/_abcoll.py
@@ -300,16 +300,6 @@ class MutableSet(Set):
self.discard(value)
return value
- def toggle(self, value):
- """Return True if it was added, False if deleted."""
- # XXX This implementation is not thread-safe
- if value in self:
- self.discard(value)
- return False
- else:
- self.add(value)
- return True
-
def clear(self):
"""This is slow (creates N new iterators!) but effective."""
try:
@@ -330,9 +320,13 @@ class MutableSet(Set):
return self
def __ixor__(self, it: Iterable):
- # This calls toggle(), so if that is overridded, we call the override
+ if not isinstance(it, Set):
+ it = self._from_iterable(it)
for value in it:
- self.toggle(it)
+ if value in self:
+ self.discard(value)
+ else:
+ self.add(value)
return self
def __isub__(self, it: Iterable):