This implementation requires that all elements are hashable,
which implies that elements must not mutate while contained.
Methods
|
|
|
|
__contains__
|
__contains__ ( self, element )
Returns true iff this set contains element.
|
|
__eq__
|
__eq__ ( self, set )
Returns true iff x == y for all elements in self, set.
|
|
__init__
|
__init__ ( self, elements=[] )
Initializes a new HashSet.
|
|
__len__
|
__len__ ( self )
Returns the number of elements in this set.
|
|
__ne__
|
__ne__ ( self, set )
Returns true iff this set is not equal to set.
|
|
__repr__
|
__repr__ ( self )
Returns a debugging string representation of this set.
|
|
__str__
|
__str__ ( self )
Returns a string representation of this set.
|
|
add
|
add ( self, element )
Adds element to this set.
|
|
cartesian
|
cartesian ( self, s )
Returns the Cartesian product of this set and s.
|
|
contains
|
contains ( self, element )
Returns true iff this set contains element.
|
|
difference
|
difference ( self, s )
Returns the difference of this set and s.
|
|
empty
|
empty ( self )
Returns true iff this set is empty.
|
|
intersection
|
intersection ( self, s )
Returns the intersection of this set and s.
|
|
list
|
list ( self )
Returns the elements of this set in a list.
|
|
remove
|
remove ( self, element )
Removes element from this set.
|
|
union
|
union ( self, s )
Returns the union of this set and s.
|