Skip to main content

Mojo trait

ReversibleRange

The ReversibleRange trait describes a range that can be reversed.

Any type that conforms to ReversibleRange works with the builtin reversed() functions.

The ReversibleRange trait requires the type to define the __reversed__() method.

Note: iterators are currently non-raising.

Implemented traits

AnyType, UnknownDestructibility

Aliases

__del__is_trivial

alias __del__is_trivial

A flag (often compiler generated) to indicate whether the implementation of __del__ is trivial.

The implementation of __del__ is considered to be trivial if:

  • The struct has a compiler-generated trivial destructor and all its fields have a trivial __del__ method.

In practice, it means that the __del__ can be considered as no-op.

Methods

__reversed__

__reversed__(self: _Self) -> _StridedRange

Get a reversed iterator for the type.

Note: iterators are currently non-raising.

Returns:

_StridedRange: The reversed iterator of the type.

Was this page helpful?