CKTIS / Python
set.isdisjoint
Tests whether the set and another iterable have no common member.
Version: Python 3.14; repository image, production runtime not attested
Syntax
s.isdisjoint(other, /)Tests whether the set and another iterable have no common member.
A single shared member makes the test false; an empty input is disjoint from every set.
This Boolean predicate tests for an empty intersection without constructing the result set. Neither 4 nor 8 belongs to {2, 3}, so the first call is true. A single 3 makes the second call false. Every set is disjoint from an empty iterable.
assert {1}.isdisjoint([]) and not {1}.isdisjoint([True])
Examples
s = {2, 3}
print(s.isdisjoint([4, 8]))
print(s.isdisjoint([3]))
Result
True False
This Boolean predicate tests for an empty intersection without constructing the result set. Neither 4 nor 8 belongs to {2, 3}, so the first call is true. A single 3 makes the second call false. Every set is disjoint from an empty iterable.