Skip to content

SortedSet

Bases: BaseSortedSet[T]


              flowchart TD
              pyochain.collections._sorted._set.SortedSet[SortedSet]
              pyochain.collections._sorted._set.BaseSortedSet[BaseSortedSet]
              pyochain.abc._mutable_set.PyoMutableSet[PyoMutableSet]
              pyochain.abc._set.PyoSet[PyoSet]
              pyochain.abc._sequences.PyoSequence[PyoSequence]
              pyochain.abc._sequences.PyoReversible[PyoReversible]
              pyochain.abc._collection.PyoCollection[PyoCollection]
              pyochain.abc._iterable.PyoIterable[PyoIterable]
              pyochain.abc._collection.PyoContainer[PyoContainer]
              pyochain.abc._collection.PyoSized[PyoSized]
              pyochain.abc._mixins.Checkable[Checkable]
              pyochain.abc._mixins.Fluent[Fluent]
              pyochain.abc._mixins.Pipe[Pipe]
              pyochain.abc._mixins.Tap[Tap]
              pyochain.collections._sorted._core.BaseSortedListSet[BaseSortedListSet]
              pyochain.collections._sorted._core.SortedCollection[SortedCollection]

                              pyochain.collections._sorted._set.BaseSortedSet --> pyochain.collections._sorted._set.SortedSet
                                pyochain.abc._mutable_set.PyoMutableSet --> pyochain.collections._sorted._set.BaseSortedSet
                                pyochain.abc._set.PyoSet --> pyochain.abc._mutable_set.PyoMutableSet
                                pyochain.abc._collection.PyoCollection --> pyochain.abc._set.PyoSet
                                pyochain.abc._iterable.PyoIterable --> pyochain.abc._collection.PyoCollection
                                pyochain.abc._mixins.Checkable --> pyochain.abc._iterable.PyoIterable
                
                pyochain.abc._mixins.Fluent --> pyochain.abc._iterable.PyoIterable
                                pyochain.abc._mixins.Pipe --> pyochain.abc._mixins.Fluent
                
                pyochain.abc._mixins.Tap --> pyochain.abc._mixins.Fluent
                


                pyochain.abc._collection.PyoContainer --> pyochain.abc._collection.PyoCollection
                                pyochain.abc._mixins.Checkable --> pyochain.abc._collection.PyoContainer
                

                pyochain.abc._collection.PyoSized --> pyochain.abc._collection.PyoCollection
                                pyochain.abc._mixins.Checkable --> pyochain.abc._collection.PyoSized
                




                pyochain.abc._sequences.PyoSequence --> pyochain.collections._sorted._set.BaseSortedSet
                                pyochain.abc._sequences.PyoReversible --> pyochain.abc._sequences.PyoSequence
                                pyochain.abc._iterable.PyoIterable --> pyochain.abc._sequences.PyoReversible
                                pyochain.abc._mixins.Checkable --> pyochain.abc._iterable.PyoIterable
                
                pyochain.abc._mixins.Fluent --> pyochain.abc._iterable.PyoIterable
                                pyochain.abc._mixins.Pipe --> pyochain.abc._mixins.Fluent
                
                pyochain.abc._mixins.Tap --> pyochain.abc._mixins.Fluent
                



                pyochain.abc._collection.PyoCollection --> pyochain.abc._sequences.PyoSequence
                                pyochain.abc._iterable.PyoIterable --> pyochain.abc._collection.PyoCollection
                                pyochain.abc._mixins.Checkable --> pyochain.abc._iterable.PyoIterable
                
                pyochain.abc._mixins.Fluent --> pyochain.abc._iterable.PyoIterable
                                pyochain.abc._mixins.Pipe --> pyochain.abc._mixins.Fluent
                
                pyochain.abc._mixins.Tap --> pyochain.abc._mixins.Fluent
                


                pyochain.abc._collection.PyoContainer --> pyochain.abc._collection.PyoCollection
                                pyochain.abc._mixins.Checkable --> pyochain.abc._collection.PyoContainer
                

                pyochain.abc._collection.PyoSized --> pyochain.abc._collection.PyoCollection
                                pyochain.abc._mixins.Checkable --> pyochain.abc._collection.PyoSized
                



                pyochain.collections._sorted._core.BaseSortedListSet --> pyochain.collections._sorted._set.BaseSortedSet
                                pyochain.collections._sorted._core.SortedCollection --> pyochain.collections._sorted._core.BaseSortedListSet
                




              click pyochain.collections._sorted._set.SortedSet href "" "pyochain.collections._sorted._set.SortedSet"
              click pyochain.collections._sorted._set.BaseSortedSet href "" "pyochain.collections._sorted._set.BaseSortedSet"
              click pyochain.abc._mutable_set.PyoMutableSet href "" "pyochain.abc._mutable_set.PyoMutableSet"
              click pyochain.abc._set.PyoSet href "" "pyochain.abc._set.PyoSet"
              click pyochain.abc._sequences.PyoSequence href "" "pyochain.abc._sequences.PyoSequence"
              click pyochain.abc._sequences.PyoReversible href "" "pyochain.abc._sequences.PyoReversible"
              click pyochain.abc._collection.PyoCollection href "" "pyochain.abc._collection.PyoCollection"
              click pyochain.abc._iterable.PyoIterable href "" "pyochain.abc._iterable.PyoIterable"
              click pyochain.abc._collection.PyoContainer href "" "pyochain.abc._collection.PyoContainer"
              click pyochain.abc._collection.PyoSized href "" "pyochain.abc._collection.PyoSized"
              click pyochain.abc._mixins.Checkable href "" "pyochain.abc._mixins.Checkable"
              click pyochain.abc._mixins.Fluent href "" "pyochain.abc._mixins.Fluent"
              click pyochain.abc._mixins.Pipe href "" "pyochain.abc._mixins.Pipe"
              click pyochain.abc._mixins.Tap href "" "pyochain.abc._mixins.Tap"
              click pyochain.collections._sorted._core.BaseSortedListSet href "" "pyochain.collections._sorted._core.BaseSortedListSet"
              click pyochain.collections._sorted._core.SortedCollection href "" "pyochain.collections._sorted._core.SortedCollection"
            

Sorted set is a MutableSet whose values are maintained in sorted order.

The design of sorted set is simple: sorted set uses a set for set-operations and maintains a sorted list of values.

Sorted set values must be hashable and comparable.

The hash and total ordering of values must not change while they are stored in the sorted set.

Sorted set comparisons use subset and superset relations.

Two sorted sets are equal if and only if every element of each sorted set is contained in the other (each is a subset of the other).

A sorted set is less than another sorted set if and only if the first sorted set is a proper subset of the second sorted set (is a subset, but is not equal).

A sorted set is greater than another sorted set if and only if the first sorted set is a proper superset of the second sorted set (is a superset, but is not equal).

Optional iterable argument provides an initial iterable of values to initialize the sorted set.

Runtime complexity: O(n*log(n))

from pyochain.collections import SortedSet

ss = SortedSet([3, 1, 2, 5, 4])
assert repr(ss) == "SortedSet([1, 2, 3, 4, 5])"

Parameters:

Name Type Description Default
iterable Iterable[T] | None

initial values (optional)

None
Source code in pyochain/collections/_sorted/_set.pyi
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
@final
class SortedSet[T: SupportsHashableAndRichComparison](BaseSortedSet[T]):
    """Sorted set is a `MutableSet` whose values are maintained in sorted order.

    The design of sorted set is simple: sorted set uses a set for set-operations and maintains a sorted list of values.

    Sorted set values must be hashable and comparable.

    The hash and total ordering of values must not change while they are stored in the sorted set.

    Sorted set comparisons use subset and superset relations.

    Two sorted sets are equal if and only if every element of each sorted set is contained in the other (each is a subset of the other).

    A sorted set is less than another sorted set if and only if the first sorted set is a proper subset
    of the second sorted set (is a subset, but is not equal).

    A sorted set is greater than another sorted set if and only if the first sorted set is a proper superset of the second sorted set (is a superset, but is not equal).

    Optional `iterable` argument provides an initial iterable of values to initialize the sorted set.

    Runtime complexity: `O(n*log(n))`

    ```python
    from pyochain.collections import SortedSet

    ss = SortedSet([3, 1, 2, 5, 4])
    assert repr(ss) == "SortedSet([1, 2, 3, 4, 5])"
    ```

    Args:
        iterable (Iterable[T] | None): initial values (optional)

    """

    def __init__(self, iterable: Iterable[T] | None = None) -> None: ...
    @override
    def __reduce__(
        self,
    ) -> tuple[type[Self], tuple[AbstractSet[T]]]: ...
    @override
    def union(self, *iterables: Iterable[T]) -> Self: ...