_.range
Generate a List of Integers Without Typing Them Out
- py_list
- LIST
_.range builds a list of integers for you. Set a start, a stop, and a step, and it returns the whole arithmetic progression as a LIST - 0,1,2,3,4,5, say. It's the "make me a sequence" node, and it's the natural way to drive batch operations or feed a list of indexes into a loop.
How it works
The semantics are Python's range through and through:
startis included,stopis excluded - range0to5gives[0, 1, 2, 3, 4], no fivestepcontrols the increment; negative steps count down, so5down to0with step-1gives[5, 4, 3, 2, 1]- If you leave
startunset it defaults to0;stepdefaults to1
The exclusive stop is the thing that bites everyone at least once. If you want five values starting at 0, your stop is 5 - which feels like a fencepost error the first time you count the output and see four items.
The inputs:
py_list- the primary input (also accepts a_.CHAIN)start- INT widget, default0stop- INT widget, default0step- INT widget, default1
Output: a LIST of integers.
What you'd use it for
The obvious pattern is batch iteration: generate a range of indexes, then fan that list out into a repeat/loop structure or a batch-processing node that wants one value per pass. It's also handy for building test data or generating sequences of values to feed into a formatter. It's the "give me all the frame numbers" node for anything frame-indexed.
If you need something that ticks - outputs one value at a time and tells you when it's exhausted or wrapped - this same pack ships XRange, which is a friendlier choice for iterator-style use. _.range is for when you want the whole list materialized in one shot.
The family mechanics
Like the rest of the underscore nodes, the primary input accepts a _.CHAIN, and when it's a plain value the node deep-copies it, runs, and returns the finished list without touching your source.
Installing
Part of comfy-ovum. ComfyUI Manager → search comfy-ovum → Install, or:
cd ComfyUI/custom_nodes
git clone https://github.com/sfinktah/comfy-ovum
Restart ComfyUI. No models, no extra pip packages for the underscore nodes - the port is bundled in the repo.
The bottom line
The fastest way to materialize a sequence of integers in your graph. Just remember: stop is exclusive, and negative steps count down.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| py_listopt | * | Primary input object (expected array). You can still pass any JSON-serializable value. Also accepts _.CHAIN to continue chaining. | |
| startopt | INT | 0 | start (int) |
| stopopt | INT | 0 | stop (int) |
| stepopt | INT | 1 | step (int) |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| LIST | LIST | — |