Nodes/Basic data handling/convert to LIST
ComfyUI Node

convert to LIST

The conversion that admits it lost your order

By StableLlama·Created about a year ago·Updated 4 days ago· 48
convert to LIST
  • set
  • LIST

convert to LIST takes a SET - a Python set passed as a single variable - and hands you back a LIST, the pack's ordered, duplicate-allowing Python list type. Same underlying conversion as convert to Data List, but the destination is a single list object instead of ComfyUI's per-item data list.

When you want this: you've built a deduped pool with sets and now need an ordered, index-addressable collection. A SET gives you uniqueness and fast membership checks but no order; a LIST gives you order, index access via get item, first, last, slice, and duplicates if you ever need them. Converting is how you move from "unique pool" to "a list I can actually position things in."

The output's own docs are refreshingly honest about the catch: the order of the resulting LIST is arbitrary, because sets are unordered collections. The conversion doesn't invent an order you never had - it just stops pretending.

How it works

The mechanism is list(set) - iterate the set and build a Python list. It's a copy, so the original set is untouched and remains usable elsewhere. The output is a single LIST variable (not a fanned-out data list), which means it plugs into the pack's LIST nodes as a whole unit.

The practical workflow is often set → convert to LIST → sort (in the LIST category) → index access. Sorting after conversion is the way you recover determinism that the set inherently lacks.

Inputs and output

  • set (SET) - the set to convert.
  • LIST (output) - a list containing every element of the set, in arbitrary order.

One required input, one LIST out. Nothing else to set up.

Installing

It's in Basic data handling by StableLlama. ComfyUI Manager - search "Basic data handling", install, restart - is the fastest path. Manual install:

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

Restart ComfyUI after cloning. Zero dependencies and no model downloads - a painless, seconds-long install typical of this pack.

Common issues

The order caveat is the whole story. If you convert and your list comes out in a weird sequence, nothing is broken - that's what "arbitrary" means. Don't fight it by re-running; sort explicitly. And choose the right destination: if the thing you're feeding wants individual items processed per-element, you need convert to Data List instead. LIST stays one object; data list fans out.

CategoryBasic/SET

Inputs (1)

NameTypeDefaultDescription
setSET

Outputs (1)

NameTypeDescription
LISTLIST