Ordered Set Recipe¶
-
class
sortedcollections.
OrderedSet
(iterable=())[source]¶ Like OrderedDict, OrderedSet maintains the insertion order of elements.
For example:
>>> ordered_set = OrderedSet('abcde') >>> list(ordered_set) == list('abcde') True >>> ordered_set = OrderedSet('edcba') >>> list(ordered_set) == list('edcba') True
OrderedSet also implements the collections.Sequence interface.
-
__str__
()¶ Text representation of set.
-
__weakref__
¶ list of weak references to the object (if defined)
-
count
(key)¶ key in ordered_set
-