PyDocs

Nav

Python Runtime Services

set

  • set(iterable=(), /)
Build an unordered collection of unique elements.
Members of set

a

add
Add an element to a set.

c

clear
Remove all elements from this set.
copy
Return a shallow copy of a set.

d

difference
Return a new set with elements in the set that are not in the others.
difference_update
Update the set, removing elements found in others.
discard
Remove an element from a set if it is a member.

i

intersection
Return a new set with elements common to the set and all others.
intersection_update
Update the set, keeping only elements found in it and all others.
isdisjoint
Return True if two sets have a null intersection.
issubset
Report whether another set contains this set.
issuperset
Report whether this set contains another set.

p

pop
Remove and return an arbitrary set element.

r

remove
Remove an element from a set; it must be a member.

s

symmetric_difference
Return a new set with elements in either the set or other but not both.
symmetric_difference_update
Update the set, keeping only elements found in either set, but not in both.

u

union
Return a new set with elements from the set and all others.
update
Update the set, adding elements from all others.
0 Examples
No examples for builtins/set.
See Also
No see-alsos for builtins/set
0 Notes
No notes for set