Python Function Reference

set.issuperset

Check that every item of other is in the set.

Python 3.13
set.issuperset(other)

Parameters

otherIterable
The collection to compare the set with.

Return value

True or False; any set is a superset of an empty set.

Examples

Superset check

Python 3.13
print({1, 2, 3}.issuperset({1, 2}))
True

All required fields are present

Python 3.13
form = {'name': 'Anna', 'email': 'anna@example.com', 'age': 30}
print(set(form).issuperset(['name', 'email']))
True

Details

For sets, the >= operator does the same, and the > operator also checks that the sets are not equal.

See also

Where to learn