Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / Python

set.issuperset

Tests whether the receiver contains every member of the other iterable.

Version: Python 3.14; repository image, production runtime not attested

Syntax

s.issuperset(other, /)

Tests whether the receiver contains every member of the other iterable.

Every set is a superset of the empty set; an extra required element makes the test fail.

Read the test from the argument towards the receiver. An empty list requires no elements, giving True for {2, 3}. The list [2, 8] requires 8 as well as 2, giving False. Equal contents qualify, and the test returns a Boolean without mutation.

assert {1}.issuperset([]) and frozenset() not in {1}

Examples

s = {2, 3}
print(s.issuperset([]))
print(s.issuperset([2, 8]))

Result

True
False

Read the test from the argument towards the receiver. An empty list requires no elements, giving True for {2, 3}. The list [2, 8] requires 8 as well as 2, giving False. Equal contents qualify, and the test returns a Boolean without mutation.

Sources