ComfyUI Node

List Merger

Two lists in, three ways to combine them

By DebugPadawan·Created about a year ago·Updated 5 months ago· 2
List Merger
  • list_a
  • list_b
  • merged_list
  • count
mode

Combining two lists is one of those operations with no obvious "right" answer - do you just stick them together? Weave them? Merge and deduplicate? List Merger gives you all three with a dropdown, and a count so you know what you got. It's the pack's join node, and the mode choice is the entire plot.

It's part of DebugPadawan's ComfyUI Essentials, a small MIT-licensed utility pack with a full family of list nodes.

The three modes

  • concatenate - list_a + list_b. Simple append: [1, 2] + ["a", "b"][1, 2, "a", "b"]. Duplicates stay; order is a-then-b.
  • interleave - weave them: [1, 2, 3] and ["a", "b", "c"][1, "a", 2, "b", 3, "c"]. When one list runs out, the longer one just continues alone - perfect for pairing two sequences.
  • union - concatenate, then deduplicate preserving first-seen order. The convenience option when you want "all the items from both, no repeats."

The gotcha: union dedups by string

Same trap as the pack's Deduplicator: union compares items by their string form. The integer 1 and the string "1" collide and one gets dropped. For tag lists and prompt lists - the 90% case - that's exactly right. For numeric lists where 1 and "1" are meaningfully different, union will quietly merge them.

Inputs and outputs

  • list_a, list_b - the two LISTs.
  • mode - concatenate / interleave / union.

Outputs: merged_list (LIST) and count (INT). In union mode, count is the number of unique items after dedup.

Install

Standard custom-node fare:

cd ComfyUI/custom_nodes
git clone https://github.com/DebugPadawan/DebugPadawans-ComfyUI-Essentials.git

Restart ComfyUI, or install via ComfyUI Manager by searching "DebugPadawan". requirements.txt lists numpy, torch, and opencv-python - numpy and torch already ship with ComfyUI and the shipped code never imports cv2, so no heavy downloads, no model files, no API keys.

When to reach for which

  • concatenate when order matters and you want everything, duplicates included - then deduplicate separately with the Deduplicator if you must.
  • interleave when you have paired data - prompt + strength, name + value - and want them alternating.
  • union when you just want the combined unique set and don't care about which list "won."

One honest note: there's no "difference" or "intersection" mode here. If you need set operations beyond union, that's outside this node's job description.

CategoryDebugPadawan/List

Inputs (3)

NameTypeDefaultDescription
list_aLIST
list_bLIST
modeCOMBO3 options: concatenate, interleave, union

Outputs (2)

NameTypeDescription
merged_listLIST
countINT