Slicing List π¦βπ₯
Grab a chunk of any list β the slice node for the rest of your graph
- input_list
- sliced
If you've ever wanted to take items 3 through 7 out of a ten-item list inside a workflow, you've wanted this node. It does exactly one thing: pull a contiguous chunk out of any list or tuple, starting at a given index, of a given length. It accepts any type of input, so it works on image batches, prompt lists, string arrays, whatever you're carrying.
Why you'd reach for it
Lists are everywhere in ComfyUI once you get past single-image workflows - batches of frames, batches of masks, lists of prompts, lists of filenames - and the core nodes rarely give you a clean way to grab a subset. Slicing List is the plumbing you reach for when you need to cut a range out of the middle. It's a boring node, and that's the point: it does one thing predictably, so your workflow logic doesn't have to.
How it works
Mechanically it's Python list slicing with training wheels: input_list[start : start + length]. The node first checks that the input is actually a list or tuple and raises a clear error otherwise. One useful behavior to know: Python slicing is forgiving on the far end. If start + length runs past the end of the list, you don't get an error - you get a shorter result. Slice off the end by accident and the node silently returns whatever was left.
The inputs
Three, all required:
input_list- the list to slice. Type is*, so anything list-like works.start- the starting index,0-based. Minimum0, default0.length- how many items to take. Minimum1, default1.
The output is sliced, and here's the detail that catches people: it's always a list. Even start=2, length=1 returns a one-element list, not the element itself. If you want a single item out of a list, you'll still be handling a list on the far side of this node.
Installing it
Part of ComfyUI-ArchiGraph. ComfyUI Manager β search "ArchiGraph" β install β restart, or by hand:
cd ComfyUI/custom_nodes
git clone https://github.com/vincentfs/ComfyUI-ArchiGraph
cd ComfyUI-ArchiGraph
pip install -r requirements.txt # or install.bat / install.sh
The pack pulls in opencv-python, opencv-contrib-python, matplotlib, and numba even though a slice node doesn't need any of them.
Where people get burned
Two things trip people up. First, the output-is-a-list behavior above - a beginner wires sliced into something expecting a single item and gets a type error that makes no sense until you remember the wrapper. Second, the distinction from its sibling AG Slicing Sublist: this node slices one flat list, while the sibling slices every sublist inside a list of lists. Give a list-of-lists to this node and you'll get a contiguous chunk of sublists, which is usually not what you meant. And if you're feeding it a tensor or a numpy array rather than a Python list, the validation will reject it - convert it to a list first.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| input_list | * | Input list to slice. | |
| start | INT | 0 | Start index for slicing. |
| length | INT | 1 | Length for slicing. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| sliced | * | β |