Python Glossary Русский

all Python 3Sets (set)function

frozenset.issuperset

frozenset

True if the frozenset contains every element of the other set (superset).

Syntax

f.issuperset(other)

Subset and superset are not opposites: for {1, 2} and {2, 3} neither contains the other, so both issubset and issuperset return False. The >= operator demands sets on both sides, whereas the method happily takes any iterable — a list, tuple or string.

Examples

print(frozenset({1, 2, 3}).issuperset({1, 2}))   # → True
print(frozenset({1, 2, 3}).issuperset({1, 5}))   # → False
print(frozenset({1, 2, 3}).issuperset([2, 3]))   # → True
print(frozenset('0123456789').issuperset('2026'))   # → True
print(frozenset({1, 2}).issuperset([]))   # → True
print(frozenset({1, 2}) > {1, 2})   # → False

See also

Open in the full glossarydocs.python.orgReport an inaccuracy