Documentation

util.lists.range

Generates a list of decimal values in a range from start (inclusive) up to stop (exclusive) in increments of step. This is similar to Python's built-in range, but the returned values are stored as sneq decimals.

def range(
  start: dec, int, or None = None,
  stop: dec, int, or None = None,
  step: dec, int, or None = None,
) -> list
  • start: The starting value (default 0 if stop is given and start is omitted).
  • stop: The stopping value (exclusive).
  • step: The increment (default 1 if omitted). Cannot be 0.

Behavior:

  • If only stop is provided (and start is None), the sequence is [0, 1, 2, ..., stop - 1].
  • If start and stop are provided but step is not, the step defaults to 1.
  • If start, stop, and step are all provided, it uses the standard (start, stop, step) iteration.
  • If stop is None (or not provided), an empty list is returned.

Example:

# range(stop=5) -> [0, 1, 2, 3, 4]
nums = util.lists.range(stop=5)

# range(start=2, stop=5) -> [2, 3, 4]
nums = util.lists.range(start=2, stop=5)

# range(start=0, stop=10, step=2) -> [0, 2, 4, 6, 8]
nums = util.lists.range(start=0, stop=10, step=2)

# If none of (start, stop, step) are provided, returns [].
nums = util.lists.range() # -> []