ComfyUI Node

to LIST

Wrap anything into one Python list that travels as a single value

By StableLlama·Created about a year ago·Updated about 15 hours ago· 48
to LIST
  • input
  • LIST

ComfyUI has two very different ideas that both get called "a list," and confusing them is half the trouble people have with this pack. There's the native data list - a batch where each item gets processed individually by downstream nodes - and there's the LIST, a Python list that travels as a single opaque value. to LIST is the bridge: it takes anything and hands you the LIST version.

It's part of Basic data handling, StableLlama's zero-dependency utility pack, and it's one of the cast nodes that live in the "Basic/cast" category alongside to STRING, to SET, and the rest.

How it works

The logic is deliberately simple:

  • If the input is already a list, it passes through unchanged.
  • Anything else gets wrapped: [input].

So a single string becomes a one-element list, an INT becomes [42], and a data list arrives as the Python list you'd expect. One input, one output, nothing to configure.

When you'd use it

The LIST type matters when you want to manipulate a whole collection as a unit - the pack has a whole LIST family (append, extend, get_item, sort, length…) that operates on it, plus SETs and DICTs for the same "one variable" treatment. Common pattern: build a LIST, do a few whole-collection operations on it, and when you're done convert back to a data list with the pack's convert to data list node so normal nodes will process the items individually again.

The input and output

  • input (*) - anything: a scalar, a data list, a string.
  • LIST (output) - the Python list.

Installing it

ComfyUI Manager → search "Basic data handling", or:

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

Restart. No dependencies, no model downloads.

Common issues

  • "I cast my data list and now nothing processes it." Expected - that's the point of LIST. Downstream nodes that expect single items won't auto-iterate over a LIST the way they do over a data list. Convert back to a data list when you're done.
  • "I wanted to force a single value into a list and got the same list back." If the input was already a list, it's passed through untouched rather than re-wrapped - which is usually what you want, but means to LIST won't turn [1, 2] into [[1, 2]].
  • "It shows up as a red/pink connection." LIST is a custom type in this pack, so it only connects to other nodes that understand it - generally this pack's own LIST-family nodes. That's not a bug.
CategoryBasic/cast

Inputs (1)

NameTypeDefaultDescription
input*

Outputs (1)

NameTypeDescription
LISTLIST