Nodes/comfy-ovum/Batch Slice Ovum
ComfyUI Node

Batch Slice Ovum

Take a chunk out of a list, JavaScript-style

By sfinktah·Created about a year ago·Updated 10 months ago· 7
Batch Slice Ovum
  • py_list
  • *
start
end

If you've ever used Python's list slicing - my_list[1:4] - you know exactly what Batch Slice does, with one important twist: it follows JavaScript's slice semantics, where negative indices count from the end and everything is clamped to the list's bounds instead of throwing. The author wrote it to mirror JS Array.prototype.slice, and if you've ever lost a workflow to a Python IndexError at 2 a.m., you'll appreciate a slice that refuses to blow up.

It's a list-level utility in the ovum/lists/comfy group, which means the output is flagged as a list so ComfyUI knows downstream consumers are getting a collection. Feed it a list of prompts, seeds, paths, or anything else, and pull out a contiguous chunk - perfect for splitting a big batch into "process the first N now, queue the rest," or grabbing a validation subset of a generated list.

The inputs

  • py_list (*) - the source list.
  • start (STRING) - the start index as text. Negative counts from the end; leave blank for 0. Clamped to bounds.
  • end (STRING) - the end index (not included). Negative counts from the end; blank means "to the end." Clamped to bounds.

The start/end fields being text inputs is a quirk - the node parses the string into an int at runtime, and blanks mean "use the default." If start lands at or past end after normalization, you get an empty list rather than an error. That's the JS-style "never crashes, just gives you a sensible empty result" behavior.

Output is a single list (*) - the requested chunk. Non-mutating, so your input list is untouched.

A couple of quick recipes

  • start=0, end=2 → the first two items.
  • start=-2 (end blank) → the last two items.
  • start=3, end=-1 → from index 3 up to but excluding the last item.

Installing it

Comes with comfy-ovum:

cd ComfyUI/custom_nodes
git clone https://github.com/sfinktah/comfy-ovum

Restart, or find it via ComfyUI Manager under "comfy-ovum". No models, no extra dependencies.

Gotchas

The string-typed start/end fields are the main thing that'll trip you up - type 2 into the box and it's fine, but a stray space or a non-numeric character means the parse fails (the node then treats the field as its default). Keep the fields clean integers or blank. And because output is list-flagged, wiring the result into a node that expects a single scalar will look like a type mismatch - slice output is meant for list consumers.

Categoryovum/lists/comfy

Inputs (3)

NameTypeDefaultDescription
py_list*
startSTRING
endSTRING

Outputs (1)

NameTypeDescription
**