OrderedSet¶
- class orderedsets.OrderedSet(items: ~typing.Iterable[~orderedsets.T] | ~typing.Type[~orderedsets._NotProvided] = <class 'orderedsets._NotProvided'>)[source]¶
Bases:
AbstractSet
[T
]A set class that preserves insertion order.
It can be used as a drop-in replacement for
set
where ordering is desired.- __init__(items: ~typing.Iterable[~orderedsets.T] | ~typing.Type[~orderedsets._NotProvided] = <class 'orderedsets._NotProvided'>) None [source]¶
Create a new
OrderedSet
, optionally initialized with items.
- copy() OrderedSet[T] [source]¶
Return a shallow copy of this set.
- difference(*others: Iterable[T]) OrderedSet[T] [source]¶
Return all elements that are in this set but not in others.
- difference_update(*others: Iterable[T]) None [source]¶
Update this set to remove all items that are in others.
- intersection(*others: Iterable[T]) OrderedSet[T] [source]¶
Return a new set with elements common to this set and all others.
- intersection_update(*others: Iterable[T]) None [source]¶
Update this set to be the intersection of itself and others.
- symmetric_difference(s: Iterable[T]) OrderedSet[T] [source]¶
Return the symmetric difference of this set and s.
- symmetric_difference_update(s: Iterable[T]) None [source]¶
Update this set to be the symmetric difference of itself and s.
- union(*others: Iterable[T]) OrderedSet[T] [source]¶
Return a new set with elements from this set and others.
FrozenOrderedSet¶
- class orderedsets.FrozenOrderedSet(items: ~typing.Iterable[~orderedsets.T] | ~typing.Type[~orderedsets._NotProvided] = <class 'orderedsets._NotProvided'>)[source]¶
Bases:
AbstractSet
[T
]A frozen set class that preserves insertion order.
It can be used as a drop-in replacement for
frozenset
where ordering is desired.- __init__(items: ~typing.Iterable[~orderedsets.T] | ~typing.Type[~orderedsets._NotProvided] = <class 'orderedsets._NotProvided'>) None [source]¶
Create a new
FrozenOrderedSet
, optionally initialized with items.
- copy() FrozenOrderedSet[T] [source]¶
Return a shallow copy of this set.
- difference(*others: Iterable[T]) FrozenOrderedSet[T] [source]¶
Return the difference of this set and others.
- intersection(*others: Iterable[T]) FrozenOrderedSet[T] [source]¶
Return the intersection of this set and others.
Internal stuff that is only here because the documentation tool wants it¶
- class orderedsets.T¶
A type variable.