If you search PyPI, you will find the collections-extended
module (https://pypi.python.org/pypi/collections-extended/1.0.0). Collections-extended expands the number of collections types available.
The following classes are included:
A bag
(also called a multiset in other languages) generalizes the concept of a set so that it allows multiple instances of elements. For example, {a, a, b}, and {a, b} are different bags, but part of the same set. Only hashable elements can be used in a bag
. An important point about bags is the multiplicity of elements. Multiplicity is the the number of instances of an element in a specific bag, that is, how many duplicate values exist in a bag.
setlist
: This creates an ordered, indexed collection with unique elements.setlist
is used to create an object that is similar to anordered set,...