Nodes/comfy-ovum/List Splice
ComfyUI Node

List Splice

List Splice — edit a list in place, delete-and-insert style (deprecated, mind)

By sfinktah·Created about a year ago·Updated 10 months ago· 7
List Splice
  • py_list
  • insert_list
  • *
  • *
start
delete_count

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 a STRING. Blank → 0. Negative → n + start, clamped to [0, n].
  • delete_count - how many elements to remove, also a STRING. Blank → delete to the end (n - start). Negative → 0 (delete nothing). Clamped to what's actually left.
  • insert_list - elements to insert at start. 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/ListExtend if you need non-destructive behavior.
  • Deprecated. Prefer ListSpliceOvum.
  • Blank delete_count deletes to the end of the list - leave it blank and you've just truncated everything from start onward. Type the count deliberately.
  • Non-list py_list raises ValueError: Input must be a Python list.
Categoryovum/lists/any

Inputs (4)

NameTypeDefaultDescription
py_list*
startSTRINGOptional start index as integer string. Blank/whitespace -> 0. Negative -> n+start (clamped).
delete_countSTRINGOptional 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)

NameTypeDescription
**
**