CKTIS / Python
set.issubset
Tests whether every member occurs in the other iterable.
Version: Python 3.14; repository image, production runtime not attested
Syntax
s.issubset(other, /)Tests whether every member occurs in the other iterable.
Equality counts as inclusion. A single missing member causes the test to fail.
Every member of s must occur in the other iterable. Equality is sufficient, hence [2, 3] passes for {2, 3}. The shorter list [2] lacks 3 and fails. An empty receiver is a subset of every input; no set is modified.
assert {1, 2}.issubset([2, 1]) and not ({1, 2} < {2, 1})
Examples
s = {2, 3}
print(s.issubset([2, 3]))
print(s.issubset([2]))
Result
True False
Every member of s must occur in the other iterable. Equality is sufficient, hence [2, 3] passes for {2, 3}. The shorter list [2] lacks 3 and fails. An empty receiver is a subset of every input; no set is modified.