ComfyUI Node

_.sum

Add up the values in a list, literally

By sfinktah·Created about a year ago·Updated 10 months ago· 7
_.sum
  • obj
  • *
initialfalse

_.sum adds up the values in a collection and hands you the total. It's the arithmetic workhorse: sum a list of costs, total up token counts, add together a stack of duration values, accumulate any numbers your workflow produced. [1, 2, 3] → 6. That's the whole node.

And here's the part you should read before you trust it in a real graph: the author's docstring for the underlying method literally says "Add shit up -- todo." This is the comfy-ovum ovum/underscore family in miniature - auto-generated wrappers around underscore3, the Python port of Underscore.js bundled in the pack, and the author's own README flags the whole family as a work in progress that's "not recommended for use in workflows." The sum itself works; the polish around it does not, and the quirks below are exactly what that warning is about.

Inputs and the quirk that matters

  • obj (*) - the collection of numbers to sum. Values are extracted from dicts too (it sums the values).
  • initial (BOOLEAN, default false) - this is the giveaway that the wrapper generator has rough edges. The underlying signature is sum(iteratee=None, initial=0), with a starting value of 0. But Python's 0 == False, so the auto-generator classified the initial argument as a boolean widget. You can't meaningfully set a non-zero starting value from the UI - it's a leftover, not a feature. Just leave it.

Output is a single * carrying the summed number. Because the return type is generic, Comfy won't enforce numeric typing downstream, but you'll get an int or float back depending on your inputs. Note the family chain behavior: feed a _.CHAIN in as obj and you get a chain back, not a number - unwrap with _.value.

When to use it - and when not to

Reach for it when you've got a real list of plain numbers. Don't reach for it when your "numbers" are actually strings (they'll concat or error), or when you want a running accumulation across separate nodes - this sums one list, once, per run. For sums over tensors or image data, this isn't the node at all; that's math on batches, which lives in your tensor pack.

Install

# via ComfyUI Manager: search "comfy-ovum"
cd ComfyUI/custom_nodes
git clone https://github.com/sfinktah/comfy-ovum
# restart ComfyUI

No model downloads; pure Python, deps (aiohttp, pillow, numpy, requests, etc.) via Manager, underscore3 bundled in the repo. The one real failure mode: if obj is None or empty, you'll get the initial (0) back - which is actually the friendly outcome, but it can mask a disconnected upstream wire with a plausible zero.

Categoryovum/underscore

Inputs (2)

NameTypeDefaultDescription
objopt*Primary input object. Also accepts _.CHAIN to continue chaining.
initialoptBOOLEANfalseinitial (boolean)

Outputs (1)

NameTypeDescription
**