List Splice
List Splice — edit a list in place, delete-and-insert style (deprecated, mind)
- py_list
- insert_list
- *
- *
ListSplice is the workflow node that does what JavaScript's Array.splice does: remove a run of elements starting at a given position and, optionally, insert new elements in their place - all in place, mutating the original list. That's both its power and its trap, because most of the pack's other list nodes are proudly non-mutating, and this one is not.
And one more heads-up before you build anything with it: this class is deprecated. The source marks it DEPRECATED = True with the internal name ListSpliceDEPRECATED(batch). It still functions, so old workflows keep loading, but for new graphs grab ListSpliceOvum (the maintained Python-list version). This page is mostly here so you know what that old node in your downloaded workflow is doing.
How it works
Four inputs, per the schema:
py_list- the target list. It will be modified in place. Must be a real Python list.start- where to begin, as aSTRING. Blank → 0. Negative →n + start, clamped to[0, n].delete_count- how many elements to remove, also aSTRING. Blank → delete to the end (n - start). Negative → 0 (delete nothing). Clamped to what's actually left.insert_list- elements to insert atstart. Blank → insert nothing (pure deletion). A list → its items are inserted. A single non-list value → inserted as one element.
Two outputs:
*(output 0) - the same list instance after splicing, so you can thread the mutated result forward.*(output 1) - a new list of the removed elements, if you need them (e.g. to process "the items I just cut out").
Because it mutates in place, anything else connected to the same underlying list sees the change. That's the gotcha to plan around.
Where you use it
Splice is the tool for surgical list surgery: delete the 3rd through 5th items, or swap a section of a seed list with a new batch. It's especially natural in loops where you're iteratively consuming a list - remove the items you've processed so the next pass sees what's left. Pair the "removed elements" output with a fan-out when you want to process exactly what was cut.
Install
Part of comfy-ovum:
cd ComfyUI/custom_nodes
git clone https://github.com/sfinktah/comfy-ovum
or ComfyUI Manager → comfy-ovum, restart. No models, no keys.
Gotchas
- In-place mutation. If the source list feeds other branches, they'll see the splices. Use
ListSlice/ListExtendif you need non-destructive behavior. - Deprecated. Prefer
ListSpliceOvum. - Blank
delete_countdeletes to the end of the list - leave it blank and you've just truncated everything fromstartonward. Type the count deliberately. - Non-list
py_listraisesValueError: Input must be a Python list.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| py_list | * | — | |
| start | STRING | Optional start index as integer string. Blank/whitespace -> 0. Negative -> n+start (clamped). | |
| delete_count | STRING | Optional number of elements to delete as integer string. Blank/whitespace -> delete to end. Negative -> 0. Clamped to [0, n-start]. | |
| insert_list | * | Optional list of items to insert at start. Blank -> insert nothing. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| * | * | — |
| * | * | — |