sets.make(elements)
Creates a new set.
All elements must be hashable.
elements |
optional. default is None
Optional sequence to construct the set out of. |
sets.copy(s)
Creates a new set from another set.
s |
required.
A set, as returned by `sets.make()`. |
sets.to_list(s)
Creates a list from the values in the set.
s |
required.
A set, as returned by `sets.make()`. |
sets.insert(s, e)
Inserts an element into the set.
Element must be hashable. This mutates the original set.
s |
required.
A set, as returned by `sets.make()`. |
e |
required.
The element to be inserted. |
sets.contains(a, e)
Checks for the existence of an element in a set.
a |
required.
A set, as returned by `sets.make()`. |
e |
required.
The element to look for. |
sets.is_equal(a, b)
Returns whether two sets are equal.
a |
required.
A set, as returned by `sets.make()`. |
b |
required.
A set, as returned by `sets.make()`. |
sets.is_subset(a, b)
Returns whether a
is a subset of b
.
a |
required.
A set, as returned by `sets.make()`. |
b |
required.
A set, as returned by `sets.make()`. |
sets.disjoint(a, b)
Returns whether two sets are disjoint.
Two sets are disjoint if they have no elements in common.
a |
required.
A set, as returned by `sets.make()`. |
b |
required.
A set, as returned by `sets.make()`. |
sets.intersection(a, b)
Returns the intersection of two sets.
a |
required.
A set, as returned by `sets.make()`. |
b |
required.
A set, as returned by `sets.make()`. |
sets.union(args)
Returns the union of several sets.
args |
optional.
An arbitrary number of sets or lists. |
sets.difference(a, b)
Returns the elements in a
that are not in b
.
a |
required.
A set, as returned by `sets.make()`. |
b |
required.
A set, as returned by `sets.make()`. |
sets.length(s)
Returns the number of elements in a set.
s |
required.
A set, as returned by `sets.make()`. |
sets.remove(s, e)
Removes an element from the set.
Element must be hashable. This mutates the original set.
s |
required.
A set, as returned by `sets.make()`. |
e |
required.
The element to be removed. |
sets.repr(s)
Returns a string value representing the set.
s |
required.
A set, as returned by `sets.make()`. |
sets.str(s)
Returns a string value representing the set.
s |
required.
A set, as returned by `sets.make()`. |