From abf3fcf39fb3bff4d347296a083a4c62d515dacd Mon Sep 17 00:00:00 2001 From: Raymond Hettinger Date: Wed, 30 Jan 2008 00:01:07 +0000 Subject: [PATCH] Add isdisjoint() to the Set/MutableSet ABCs. --- Lib/_abcoll.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Lib/_abcoll.py b/Lib/_abcoll.py index ac967b2350..3a84b965b4 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 -- 2.40.0