3.13.1. sciexp2.common.utils.OrderedSet

Methods

add(key)

Add an element.

clear()

This is slow (creates N new iterators!) but effective.

copy()

Make a shallow copy of this OrderedSet.

discard(key)

Remove an element.

get_index(index)

Get item at the 'index'th position.

isdisjoint(other)

Return True if two sets have a null intersection.

pformat(pretty, cycle[, name])

Return pretty representation.

pop()

Return the popped value.

remove(value)

Remove an element.

set_view_able(view_able)

Set whether this object can produce "views" from it.

sort([key, reverse])

Sort set in-place.

sorted(*args, **kwargs)

Same as sort, but returns a sorted copy.

view(index)

Create a view (sub-set) of this object.

class OrderedSet(*args, **kwargs)

Bases: MutableSet, Pretty

A 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

OrderedSet.view
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
get_index(index)

Get item at the ‘index’th position.

copy()

Make a shallow copy of this OrderedSet.

sorted(*args, **kwargs)

Same as sort, but returns a sorted copy.

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.