ComfyUI Node

reverse

Flip a list end to end in one step

By StableLlama·Created about a year ago·Updated about 15 hours ago· 48
reverse
  • list
  • list

Need the last item first and the first item last? DataListReverse takes a list and hands back a new list with the order flipped. It's a one-input, one-output node - list in, list out - and it's exactly as simple as it sounds. There's no reverse flag to tick, no options to misconfigure. If you've got a list that's in the wrong order, this fixes it.

How it works

The mechanism is Python's list .reverse(), but on a copy of your input. That copy matters more than it looks: the node doesn't mutate the list you connected, so re-running the workflow gives you the same reversed result every time without any weird accumulation. The output is still a data list, so each item flows downstream as an individual element - the reversal is purely about ordering.

When you'd actually use it

Reverse earns its keep in a few unglamorous but real situations:

  • A sort put things ascending and you want descending - though for numbers, DataListSort's reverse option does that in one node without the extra hop.
  • You appended items to the end of a list as they arrived, but processing needs them oldest-first or newest-first.
  • A zip operation paired your lists up in an order you now want flipped.
  • You want the last item first to feed into a first/last-style accessor - though honestly, for grabbing the final element alone, DataListLast is the more direct tool.

It's a utility node. It's not going to change your life, but when you need it, you need it, and having it as a single block instead of a hand-rolled workaround keeps the graph readable.

Installing it

This is one of 250+ nodes in StableLlama's Basic data handling pack - pure Python, zero dependencies, no models to download:

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

Restart ComfyUI afterward, or use ComfyUI Manager and search "Basic data handling". The pack has no requirements.txt worth managing, so install is the boring two-step it should be.

Common issues

Honestly, this node barely has failure modes. The standard pack-level gotcha applies - it wants a native data list, not a single LIST variable, so convert if that's what your upstream produces. And keep in mind the output order is fully reversed, not rotated; if you meant "move the last item to the front and leave the rest alone," that's pop + append, not this. Otherwise, plug it in, watch it flip, move on.

CategoryBasic/Data List

Inputs (1)

NameTypeDefaultDescription
list*

Outputs (1)

NameTypeDescription
list*