collections.MutableSet

class collections.MutableSet[source]

A mutable set is a finite, iterable container.

This class provides concrete generic implementations of all methods except for __contains__, __iter__, __len__, add(), and discard().

To override the comparisons (presumably for speed, as the semantics are fixed), all you have to do is redefine __le__ and then the other operations will automatically follow suit.

Methods

__and__(other)
__contains__(x)
__eq__(other)
__format__ default object formatter
__ge__(other)
__gt__(other)
__iand__(it)
__ior__(it)
__isub__(it)
__iter__()
__ixor__(it)
__le__(other)
__len__()
__lt__(other)
__ne__(other)
__new__((S, ...)
__or__(other)
__rand__(other)
__reduce__ helper for pickle
__reduce_ex__ helper for pickle
__ror__(other)
__rsub__(other)
__rxor__(other)
__sizeof__(() -> int) size of object in memory, in bytes
__sub__(other)
__subclasshook__(C)
__xor__(other)
_from_iterable(it) Construct an instance of the class from any iterable input.
_hash() Compute the hash value of a set.
add(value) Add an element.
clear() This is slow (creates N new iterators!) but effective.
discard(value) Remove an element.
isdisjoint(other) Return True if two sets have a null intersection.
pop() Return the popped value.
remove(value) Remove an element.