all Python 3Sets (set)function
set.issuperset
checking
True if the set contains every element of the other (superset). Operator: >=.
Syntax
s.issuperset(other)
Set comparison is only a partial order: neither {1, 2} nor {2, 3} contains the other, so both directions come back False. That means not a.issuperset(b) does not imply the reverse relation, and calling sorted() or max() on a list of sets yields an arbitrary answer that depends on the starting arrangement.
Examples
print({1, 2, 3}.issuperset({1, 2})) # → True
print({1, 2}.issuperset({1, 3})) # → False
print({1, 2, 3} >= {1, 2}) # → True
print({1, 2, 3}.issuperset([1, 3])) # → True
print({1, 2}.issuperset(set())) # → True
print({1, 2} >= [1]) # → TypeError
See also
Open in the full glossarydocs.python.orgReport an inaccuracy