ComfyUI Node

any

Did anything pass? Python's any(), as a node

By StableLlama·Created about a year ago·Updated a day ago· 48
any
  • set
  • any_true

The any node is Python's any() with a node wrapper: feed it a SET and it returns True if at least one member is truthy, False if they're all falsy. Where all is the "everything passed" gate, this is the "did anything at all succeed" check - and in workflow terms that's the difference between "the whole batch must be clean" and "proceed if there's at least one usable result."

The pattern that keeps coming up: a batch of attempts, each producing a boolean - saved or not, valid or not, matched or not - collapsed into a SET. any then answers "is there even one success worth keeping?" Pair it with contains or length when you also need to know which one passed, and with all when the bar is "every single one."

How it works

A direct any(set) call. The semantics to know:

  • An empty SET returns False. This is the mirror image of all's empty-set-returns-True: with nothing in the set, nothing is truthy, so any says no. For "did we collect anything that worked" that's usually the sensible answer.
  • Truthiness, not equality: 0, 0.0, "", False, None, and empty containers are falsy; everything else - including "False" the string and nonzero numbers - is truthy.
  • Sets dedup, so {False, False, True} is really {False, True}, and any over it is just "is True a member." A SET of booleans is effectively a single yes/no by the time you check it.

Input and output

One input, set. One output, any_true, a BOOLEAN - ready for the pack's if/else, flow-select, or any boolean-consuming node.

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 install via ComfyUI Manager (search "Basic data handling"). No dependencies, no models - stdlib only, so install is a non-event.

Gotchas

  • Empty set → False. If your collection might legitimately be empty, decide whether "no results" should mean "don't proceed" - here it does, which is usually right but is a behavior to be aware of, not a bug.
  • It's truthiness-based, so "0" counts as true while 0 doesn't. Convert string results to real booleans before building the set if you're validating with this.
  • For "did a specific value appear," use contains, not any - any only tells you something truthy exists, not what it is.
CategoryBasic/SET

Inputs (1)

NameTypeDefaultDescription
setSET

Outputs (1)

NameTypeDescription
any_trueBOOLEAN