]> granicus.if.org Git - python/commitdiff
Add isdisjoint() to the Set/MutableSet ABCs.
authorRaymond Hettinger <python@rcn.com>
Wed, 30 Jan 2008 00:01:07 +0000 (00:01 +0000)
committerRaymond Hettinger <python@rcn.com>
Wed, 30 Jan 2008 00:01:07 +0000 (00:01 +0000)
Lib/_abcoll.py

index ac967b2350bae46a2f82737bec520ac6ff46b3d9..3a84b965b4808ab752e106446b7e54a22e58ead6 100644 (file)
@@ -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