ComfyUI Node

all

Are all the values in this SET truthy? Python's all(), as a node

By StableLlama·Created about a year ago·Updated 4 days ago· 48
all
  • set
  • all_true

This is Python's all() wearing a node costume: give it a SET and it returns True only if every member is truthy, False if any single one is falsy. It's the "did everything pass?" check for whatever collection you've accumulated in your workflow - a SET of success flags from a batch of saves, a SET of validation booleans, a SET of numbers where 0 means "failed."

Sets and booleans make a natural pair here: dedup means {True, True, True} collapses to {True}, so checking "did anything fail" becomes checking membership rather than counting. all and the pack's any are the yin and yang of that pattern - all says "everything succeeded," any says "at least one did." When you've got a set of per-item results and you need the workflow to proceed only if the whole batch is clean, this is the gate.

How it works

A direct all(set) call. Python truthiness is the semantics, and there's one behavior that surprises everyone:

  • An empty SET returns True. all([]) is True in Python by convention ("vacuously true" - nothing is falsy because there's nothing). So an empty set passes the gate, which is either what you want or a silent bug, depending on whether "no results" should count as success.
  • Falsy values are 0, 0.0, "", False, None, and empty containers. Everything else - including nonzero numbers and non-empty strings - is truthy.
  • Because it's a set, {True, 1} has only one member (they hash equal), so "all true" with both present is trivially true.

Input and output

One input, set (a SET). One output, all_true, a BOOLEAN. Wire it into the pack's if/else or flow-select to gate execution on "the whole collection passed."

Installing it

Part of Basic data handling by StableLlama:

cd ComfyUI/custom_nodes
git clone https://github.com/StableLlama/ComfyUI-basic_data_handling

Restart, or grab it via ComfyUI Manager (search "Basic data handling"). The pack has no dependencies and downloads no models.

Gotchas

  • The empty-set-returns-True gotcha is the one to remember. If your workflow feeds this an empty SET because nothing was added yet, you'll get a green light you didn't earn. Check length separately if that matters.
  • It checks truthiness, not equality. 0 fails, but "0" passes - string results from other nodes need converting to real booleans if you're building a validation set from them.
  • To invert, use the pack's boolean not or the comparison nodes; all is always "everyone must pass."
CategoryBasic/SET

Inputs (1)

NameTypeDefaultDescription
setSET

Outputs (1)

NameTypeDescription
all_trueBOOLEAN