ComfyUI Node

max

The biggest number in your list, without sorting for it

By StableLlama·Created about a year ago·Updated 4 days ago· 48
max
  • list
  • max

When you're working with batches of numbers - CFG values, step counts, seeds, strength settings - you'll eventually want to know the ceiling. DataListMax takes a list of FLOAT or INT values and returns the single largest one. It's max() from Python with a couple of safety rails bolted on.

One input, list, one output, max. Feed it numbers, get the biggest back in the same type it was found in: a list of ints gives you an int, a list of floats gives you a float, a mix gives you whichever type the largest value happened to be.

How it works

The node just calls Python's built-in max() on the whole collection - same semantics, same guarantees, no clever custom logic to second-guess. The two safety rails are what make it node-shaped rather than raw Python: an empty list returns None instead of throwing, and a list containing anything non-numeric (or otherwise non-comparable) also returns None instead of raising a TypeError mid-workflow. That last one is genuinely useful - in ComfyUI a crashed node kills the whole graph, so "return nothing and let a later node decide" is the friendlier failure mode.

Why you'd reach for it

It's the obvious partner to normalization: take a list of values, find the max, then divide each value by it to get a 0–1 scale. The pack doesn't hand you a "scale by max" node, but with DataListMax plus a math node you've built it in two steps. It's also the straightforward check on batch sizes and range validations - "did any of these go over the limit?" Pair it with the pack's comparison nodes if you want to branch on that.

Worth knowing the family: min is the mirror image, sum adds them all, and sort lets you see the whole ordering at once. If you find yourself needing max and its position in the list, you'll want to sort or use the pack's index tools instead - this node deliberately throws away everything except the single winner.

Installing it

Part of StableLlama's Basic data handling pack - pure Python, no dependencies, no model downloads, which is rare enough in the custom-node world to mention twice. Install it once and every node in the pack shows up:

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

Restart ComfyUI afterward, or search "Basic data handling" in ComfyUI Manager and let it handle the clone for you. No requirements.txt headache to manage.

Common issues

The input port is typed FLOAT,INT, so strings will trip the None fallback rather than giving you a number - convert them to ints/floats first (the pack has cast nodes for exactly that). And remember the empty-list behavior: None is not 0, so if a downstream math node gets None where it expected a number, trace it back to an upstream list that came up empty rather than blaming this node.

CategoryBasic/Data List

Inputs (1)

NameTypeDefaultDescription
listFLOAT,INT

Outputs (1)

NameTypeDescription
maxFLOAT,INT