Nodes/comfy-ovum/Ovum Length
ComfyUI Node

Ovum Length

How long is that list? Length with a passthrough

By sfinktah·Created about a year ago·Updated 10 months ago· 7
Ovum Length
  • any
  • any_out
  • length

Ovum Length does one thing: tells you how many items are in whatever you hand it, while passing the value through untouched. Give it a list, a batch, a string, a dict - anything with a length - and you get an INT count out of one socket and the original value out of the other. It's the ComfyUI equivalent of Python's len(), and it's the kind of node you don't think about until you're building a loop and suddenly need to know how many iterations are coming.

The passthrough is the sneaky-useful half. Because the input value comes back out the any_out socket, you can drop this node inline without rerouting your graph: wire your list in, branch the length off to a loop-count or a MinusOne for clamping, and feed any_out straight into whatever the list was headed to. One node, no rewiring, and you always see the number on screen for debugging.

How it works

Behind the scenes it uses the pack's list-resolution machinery to unwrap ComfyUI's list handling (INPUT_IS_LIST with a resolve step), then takes len() of the effective list. For a list input it returns a shallow copy so downstream mutation doesn't trip ComfyUI's change detection; non-list values pass through as-is. It also reports a status line to the UI - wrapped: True length: 5 - so you can see whether Comfy wrapped your value and exactly what got counted.

The inputs and outputs that matter

  • any (required, *) - the value to measure and pass through.
  • any_out (output, *) - the original value (a shallow copy if it was a list).
  • length (output, INT) - the count.

Installing it

Ships in comfy-ovum (sfinktah). Install via ComfyUI Manager - search "comfy-ovum" - or manually:

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

Restart ComfyUI either way. No models to download; the pack's dependencies are the usual light set (pillow, numpy, requests, aiohttp, etc.) and Manager installs them.

Common issues

The main thing to keep in mind is what you're measuring. A batch tensor's length is its batch size - fine if that's what you want, but if a node hands you an IMAGE that's really a batch of 8, length is 8, not 1. And strings report their character count, which is occasionally a surprise when you were counting words. If a value genuinely has no len() (say a plain float), the node relies on the pack's coercion - which, per its helpers, will try __len__ first and can fall back to __int__; when in doubt, test with a Show Text on the length socket before building logic on top of it.

Categoryovum/lists/python

Inputs (1)

NameTypeDefaultDescription
any*

Outputs (2)

NameTypeDescription
any_out*
lengthINT