ComfyUI Node

reverse

Flip a list around in one click

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

The most boring node in the pack, and that's fine

Reverse takes a LIST and returns a new LIST with the items in the opposite order. That's it. No inputs to configure, no options, no subtlety. It's one of those nodes you don't think about until a workflow hands you a list that's backwards - last-to-first order from some generator, a priority list you want to consume tail-first - and then it's exactly the tool.

It's the "reverse" you'd write as list[::-1] in Python, exposed so you don't have to.

How it works

The node copies the input list and reverses the copy in place, returning it as a new LIST. Two details matter. First, it's non-destructive: the original LIST coming in stays exactly as it was, which is the right call in a graph where one LIST object can feed several branches. Second, because it's a plain Python list operation, it works on any content - numbers, strings, mixed objects - there's no sorting logic that could fail on incomparable items, which is a trap the pack's sort node has to guard against.

Inputs and outputs

One input, one output:

  • list (LIST) - whatever you want flipped.

Output is a single LIST with items in reversed order. If you reversed a list of five things, you get five things in reverse order. That's the whole contract.

Pair it with the pack's "sort" node for a quick descending sort without touching the reverse flag: sort ascending, then reverse. Or reverse before a loop to change which end gets consumed first. It's plumbing, and plumbing is the point.

Installing it

Ships in Basic data handling by StableLlama, the author better known on r/StableDiffusion for his long-form model comparisons (his Flux Klein 9B conclusions post was one of the most-read threads of that release). This pack is the opposite flavor: tiny plain-Python utilities with zero dependencies - the pyproject declares no runtime requirements, and there are no model files or API keys anywhere near it.

Install via ComfyUI Manager (search "Basic data handling") or:

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

Restart ComfyUI; it's under Basic/LIST.

Troubleshooting

Honestly, there isn't much to break here. The two things beginners occasionally trip on: confusing reverse with sort (reverse does not order anything, it just flips the existing order), and expecting the input list to change in place. It won't - grab the output. If you wired the output to nothing, nothing happens, which is a problem with your graph, not this node.

CategoryBasic/LIST

Inputs (1)

NameTypeDefaultDescription
listLIST

Outputs (1)

NameTypeDescription
LISTLIST