Python Multiset objects
Object | Return |
---|---|
combine(*others) | Return the multiset resulting from the addition of the sets. |
copy() | Return a shallow copy of the multiset. |
difference() | Return The resulting difference multiset. |
distinct_elements() | Return the multiplicity for element if it is in the multiset, else default |
intersection() | Return a new multiset with elements common to the multiset and all others |
isdisjoint() | Return True if the set has no elements in common with other. |
issubset() | Return True if this set is a subset of the other. |
issuperset() | Return True if this multiset is a superset of the other. |
union_update() | Update the multiset, adding elements from all others using the maximum multiplicity. |
update(): | Update the multiset |
remove() | Removes an element from the multiset. |
pop() | The multiplicity for element if it is in the multiset, else default. |
Python Multiset
Multiset package is similar to the Python set but it allows elements to occur multiple times. Implementation can be based on dictionary elements( It internally uses a dict for storage) to their multiplicity in the multisets.