Skip to content

PyoReversible

Bases: PyoIterable[T], Protocol


              flowchart TD
              pyochain.abc._sequences.PyoReversible[PyoReversible]
              pyochain.abc._iterable.PyoIterable[PyoIterable]
              pyochain.abc._mixins.Checkable[Checkable]
              pyochain.abc._mixins.Fluent[Fluent]
              pyochain.abc._mixins.Pipe[Pipe]
              pyochain.abc._mixins.Tap[Tap]

                              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
                




              click pyochain.abc._sequences.PyoReversible href "" "pyochain.abc._sequences.PyoReversible"
              click pyochain.abc._iterable.PyoIterable href "" "pyochain.abc._iterable.PyoIterable"
              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"
            
Source code in pyochain/abc/_sequences.pyi
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
@runtime_checkable
class PyoReversible[T](PyoIterable[T], Protocol):
    @abstractmethod
    def __reversed__(self) -> Iterator[T]: ...
    def rev(self) -> PyoIterator[T]:
        """Return an `Iterator` with the elements of the `Sequence` in reverse order.

        Returns:
            PyoIterator[T]: An `Iterator` with the elements in reverse order.

        Example:
            ```python
            from pyochain import Seq, Range

            assert Seq(1, 2, 3).rev().collect(Seq) == Seq(3, 2, 1)
            assert Range(5).rev().collect(Seq) == Seq(4, 3, 2, 1, 0)
            ```
        """

rev()

Return an Iterator with the elements of the Sequence in reverse order.

Returns:

Type Description
PyoIterator[T]

PyoIterator[T]: An Iterator with the elements in reverse order.

Example
from pyochain import Seq, Range

assert Seq(1, 2, 3).rev().collect(Seq) == Seq(3, 2, 1)
assert Range(5).rev().collect(Seq) == Seq(4, 3, 2, 1, 0)
Source code in pyochain/abc/_sequences.pyi
12
13
14
15
16
17
18
19
20
21
22
23
24
25
def rev(self) -> PyoIterator[T]:
    """Return an `Iterator` with the elements of the `Sequence` in reverse order.

    Returns:
        PyoIterator[T]: An `Iterator` with the elements in reverse order.

    Example:
        ```python
        from pyochain import Seq, Range

        assert Seq(1, 2, 3).rev().collect(Seq) == Seq(3, 2, 1)
        assert Range(5).rev().collect(Seq) == Seq(4, 3, 2, 1, 0)
        ```
    """