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
0ifstopis given andstartis omitted). - stop: The stopping value (exclusive).
- step: The increment (default
1if omitted). Cannot be0.
Behavior:
- If only
stopis provided (andstartisNone), the sequence is[0, 1, 2, ..., stop - 1]. - If
startandstopare provided butstepis not, the step defaults to1. - If
start,stop, andstepare all provided, it uses the standard(start, stop, step)iteration. - If
stopisNone(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() # -> []