3.13.1. sciexp2.common.utils.OrderedSet
Methods
|
Add an element. |
|
This is slow (creates N new iterators!) but effective. |
|
Make a shallow copy of this |
|
Remove an element. |
|
Get item at the 'index'th position. |
|
Return True if two sets have a null intersection. |
|
Return pretty representation. |
|
Return the popped value. |
|
Remove an element. |
|
Set whether this object can produce "views" from it. |
|
Sort set in-place. |
|
Same as sort, but returns a sorted copy. |
|
Create a view (sub-set) of this object. |
- class OrderedSet(*args, **kwargs)
Bases:
MutableSet,PrettyA mutable set preserving order of insertion.
- set_view_able(view_able)
Set whether this object can produce “views” from it.
Objects able to produce views have lower performance when adding new elements to them.
See also
- view(index)
Create a view (sub-set) of this object.
This object also becomes a view. Modifications to the elements of a view will also take effect on all other views of the same object.
- Parameters:
- indexslice
See also
- get_index(index)
Get item at the ‘index’th position.
- copy()
Make a shallow copy of this
OrderedSet.
- sort(key=None, reverse=False)
Sort set in-place.
Follows the same semantics of Python’s built-in
sorted.
- add(key)
Add an element.
- discard(key)
Remove an element. Do not raise an exception if absent.
This operation has a cost of O(n).
- pop()
Return the popped value. Raise KeyError if empty.