OrderedSet¶
- class orderedsets.OrderedSet[source]¶
A set class that preserves insertion order.
It implements exactly the same API as
set
and can be used as a drop-in replacement for that class when ordering is desired.>>> oset = OrderedSet(["a", "b", "c", "d"]) >>> oset.add("X") >>> oset OrderedSet({'a', 'b', 'c', 'd', 'X'}) >>> oset == set(["a", "b", "c", "d", "X"]) True
FrozenOrderedSet¶
- class orderedsets.FrozenOrderedSet[source]¶
A frozen set class that preserves insertion order.
It implements exactly the same API as
frozenset
and can be used as a drop-in replacement for that class when ordering is desired.>>> foset = FrozenOrderedSet(["a", "b", "c", "d"]) >>> foset FrozenOrderedSet({'a', 'b', 'c', 'd'}) >>> foset == set(["a", "b", "c", "d"]) True
IndexSet¶
- class orderedsets.IndexSet[source]¶
A set class that preserves insertion order and allows indexing.
The only change in API from
set
is the addition of the__getitem__()
method.
FrozenIndexSet¶
- class orderedsets.FrozenIndexSet[source]¶
A frozen set class that preserves insertion order and allows indexing.
The only change in API from
frozenset
is the addition of the__getitem__()
method.
Type Variables¶
- class orderedsets.T¶
A type variable for items in an
OrderedSet
andIndexSet
. All items must be hashable.
- class orderedsets.T_cov¶
A (covariant) type variable for items in a
FrozenOrderedSet
andFrozenIndexSet
. All items must be hashable.