asc2.static_range

class asc2.static_range(stop: int, /)
class asc2.static_range(start: int, stop: int, /)
class asc2.static_range(start: int, stop: int, step: int, /)

A static range loop construct for use in JIT functions.

Unlike range, this class requires all loop bounds to be compile-time constants (integers), not runtime values. This enables more aggressive compile-time optimizations such as complete loop unrolling.

Parameters:
  • start – Start index of the loop (or stop index if only one argument provided)

  • stop – Stop index of the loop (exclusive). If None, start is treated as stop and start is 0.

  • step – Step size for the loop iteration

Raises:

ValueError – If number of arguments is not between 1 and 3

Note

All arguments must be integer constants, not runtime values. Use range when loop bounds are runtime-dependent.

Examples

Loop with compile-time constant bounds:

for i in asc.static_range(0, 128):
    ...
__init__(stop: int, /)
__init__(start: int, stop: int, /)
__init__(start: int, stop: int, step: int, /)

Methods

__init__()