summaryrefslogtreecommitdiffstats
path: root/Lib/_abcoll.py
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2008-01-30 11:58:22 (GMT)
committerChristian Heimes <christian@cheimes.de>2008-01-30 11:58:22 (GMT)
commit190d79e5c648174b550de2bef75d1b4addf0d625 (patch)
tree6af69a8af50c6d9f95ec5eb3372c17d36bb17fc5 /Lib/_abcoll.py
parent510711d598f1432afb021a01c2457b14334c6157 (diff)
downloadcpython-190d79e5c648174b550de2bef75d1b4addf0d625.zip
cpython-190d79e5c648174b550de2bef75d1b4addf0d625.tar.gz
cpython-190d79e5c648174b550de2bef75d1b4addf0d625.tar.bz2
Merged revisions 60408-60440 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r60425 | raymond.hettinger | 2008-01-29 20:52:09 +0100 (Tue, 29 Jan 2008) | 1 line CallMethod is faster with a NULL third-argument than with an empty format string. ........ r60431 | raymond.hettinger | 2008-01-30 01:01:07 +0100 (Wed, 30 Jan 2008) | 1 line Add isdisjoint() to the Set/MutableSet ABCs. ........ r60432 | raymond.hettinger | 2008-01-30 01:08:31 +0100 (Wed, 30 Jan 2008) | 1 line MutableSets support a remove() method. ........ r60433 | raymond.hettinger | 2008-01-30 01:51:58 +0100 (Wed, 30 Jan 2008) | 1 line Demonstrate new except/as syntax. ........ r60440 | christian.heimes | 2008-01-30 12:32:37 +0100 (Wed, 30 Jan 2008) | 1 line Patch #1970 by Antoine Pitrou: Speedup unicode whitespace and linebreak detection. The speedup is about 25% for split() (571 / 457 usec) and 35% (175 / 127 usec )for splitlines() ........
Diffstat (limited to 'Lib/_abcoll.py')
-rw-r--r--Lib/_abcoll.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/_abcoll.py b/Lib/_abcoll.py
index 36d39cf..4ce3df4 100644
--- a/Lib/_abcoll.py
+++ b/Lib/_abcoll.py
@@ -211,6 +211,12 @@ class Set(metaclass=ABCMeta):
return NotImplemented
return self._from_iterable(value for value in other if value in self)
+ def isdisjoint(self, other):
+ for value in other:
+ if value in self:
+ return False
+ return True
+
def __or__(self, other):
if not isinstance(other, Iterable):
return NotImplemented
@@ -278,6 +284,12 @@ class MutableSet(Set):
"""Return True if it was deleted, False if not there."""
raise NotImplementedError
+ def remove(self, value):
+ """Remove an element. If not a member, raise a KeyError."""
+ if value not in self:
+ raise KeyError(value)
+ self.discard(value)
+
def pop(self):
"""Return the popped value. Raise KeyError if empty."""
it = iter(self)