diff options
author | Raymond Hettinger <python@rcn.com> | 2008-01-30 00:01:07 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2008-01-30 00:01:07 (GMT) |
commit | abf3fcf39fb3bff4d347296a083a4c62d515dacd (patch) | |
tree | a1e753b1c89a53417a2ac71c8dc10ceb9952a5c3 | |
parent | 867558afd69675be8263a19c3d23b92812a0a62a (diff) | |
download | cpython-abf3fcf39fb3bff4d347296a083a4c62d515dacd.zip cpython-abf3fcf39fb3bff4d347296a083a4c62d515dacd.tar.gz cpython-abf3fcf39fb3bff4d347296a083a4c62d515dacd.tar.bz2 |
Add isdisjoint() to the Set/MutableSet ABCs.
-rw-r--r-- | Lib/_abcoll.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/_abcoll.py b/Lib/_abcoll.py index ac967b2..3a84b96 100644 --- a/Lib/_abcoll.py +++ b/Lib/_abcoll.py @@ -177,6 +177,12 @@ class Set: 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 |