Mojo function
range
range[T: Indexer, //](end: T) -> _ZeroStartingRange
Constructs a [0; end) Range.
Parameters:
- T (
Indexer): The type of the end value.
Args:
- end (
T): The end of the range.
Returns:
_ZeroStartingRange: The constructed range.
range[T: IntableRaising, //](end: T) -> _ZeroStartingRange
Constructs a [0; end) Range.
Parameters:
- T (
IntableRaising): The type of the end value.
Args:
- end (
T): The end of the range.
Returns:
_ZeroStartingRange: The constructed range.
Raises:
An error if the conversion to an Int failed.
range(end: PythonObject) -> _ZeroStartingRange
Constructs a [0; end) Range from a Python int.
Args:
- end (
PythonObject): The end of the range as a Pythonint.
Returns:
_ZeroStartingRange: The constructed range.
Raises:
An error if converting end to an Int failed.
range[T0: Indexer, T1: Indexer, //](start: T0, end: T1) -> _SequentialRange
Constructs a [start; end) Range.
Parameters:
Args:
- start (
T0): The start of the range. - end (
T1): The end of the range.
Returns:
_SequentialRange: The constructed range.
range[T0: IntableRaising, T1: IntableRaising](start: T0, end: T1) -> _SequentialRange
Constructs a [start; end) Range.
Parameters:
- T0 (
IntableRaising): The type of the start value. - T1 (
IntableRaising): The type of the end value.
Args:
- start (
T0): The start of the range. - end (
T1): The end of the range.
Returns:
_SequentialRange: The constructed range.
Raises:
An error if converting start or end to an Int failed.
range(start: PythonObject, end: PythonObject) -> _SequentialRange
Constructs a [start; end) Range from Python int objects.
Args:
- start (
PythonObject): The start of the range as a Pythonint. - end (
PythonObject): The end of the range as a Pythonint.
Returns:
_SequentialRange: The constructed range.
Raises:
An error if converting start or end to an Int failed.
range[T0: Indexer, T1: Indexer, T2: Indexer, //](start: T0, end: T1, step: T2) -> _StridedRange
Constructs a [start; end) Range with a given step.
Parameters:
- T0 (
Indexer): The type of the start value. - T1 (
Indexer): The type of the end value. - T2 (
Indexer): The type of the step value.
Args:
- start (
T0): The start of the range. - end (
T1): The end of the range. - step (
T2): The step for the range.
Returns:
_StridedRange: The constructed range.
range[T0: IntableRaising, T1: IntableRaising, T2: IntableRaising, //](start: T0, end: T1, step: T2) -> _StridedRange
Constructs a [start; end) Range with a given step.
Parameters:
- T0 (
IntableRaising): The type of the start value. - T1 (
IntableRaising): The type of the end value. - T2 (
IntableRaising): The type of the step value.
Args:
- start (
T0): The start of the range. - end (
T1): The end of the range. - step (
T2): The step for the range.
Returns:
_StridedRange: The constructed range.
Raises:
An error if converting start, end, or step to an Int failed.
range(start: PythonObject, end: PythonObject, step: PythonObject) -> _StridedRange
Constructs a [start; end) Range from Python int objects with a given step.
Args:
- start (
PythonObject): The start of the range as a Pythonint. - end (
PythonObject): The end of the range as a Pythonint. - step (
PythonObject): The step for the range as a Pythonint.
Returns:
_StridedRange: The constructed range.
Raises:
An error if converting start, end, or step to an Int failed.
range(end: UInt) -> _UIntZeroStartingRange
Constructs a [0; end) Range.
Args:
- end (
UInt): The end of the range.
Returns:
_UIntZeroStartingRange: The constructed range.
range(start: UInt, end: UInt, step: UInt = 1) -> _UIntStridedRange
Constructs a [start; end) Range with a given step.
Args:
- start (
UInt): The start of the range. - end (
UInt): The end of the range. - step (
UInt): The step for the range. Defaults to 1.
Returns:
_UIntStridedRange: The constructed range.
range[dtype: DType, //](end: Scalar[dtype]) -> _ZeroStartingScalarRange[dtype]
Constructs a [start; end) Range with a given step.
Parameters:
- dtype (
DType): The range dtype.
Args:
- end (
Scalar): The end of the range.
Returns:
_ZeroStartingScalarRange: The constructed range.
range[dtype: DType, //](start: Scalar[dtype], end: Scalar[dtype]) -> _SequentialScalarRange[dtype]
Constructs a [start; end) Range with a given step.
Parameters:
- dtype (
DType): The range dtype.
Args:
Returns:
_SequentialScalarRange: The constructed range.
range[dtype: DType, //](start: Scalar[dtype], end: Scalar[dtype], step: Scalar[dtype]) -> _StridedScalarRange[dtype]
Constructs a [start; end) Range with a given step.
Parameters:
- dtype (
DType): The range dtype.
Args:
- start (
Scalar): The start of the range. - end (
Scalar): The end of the range. - step (
Scalar): The step for the range. Defaults to 1.
Returns:
_StridedScalarRange: The constructed range.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!