Pop
Pull the first item off any list and keep the rest
- items
- *
- *
This is Python's list.pop(0) rendered as a node. Pop takes a list of anything - images, strings, latents, whatever type you wire in - and splits it into two outputs: the first item on its own, and the rest of the list. That's the entire feature set. No options, no modes, one input.
It comes from comfyui_davcha, the author's "personal QoL and experimental nodes" pack, and it's the kind of tiny primitive that only makes sense once you've wanted it. Then you want it a lot.
How it works
The input is marked as a list (INPUT_IS_LIST), and the node types are wildcards (AnyType), so it accepts any data type. Internally it returns (items[0], items[1:]) - first element as a single value, remainder as a list. The first output is explicitly not a list (a single item), the second output is a list.
Input: items (any type, as a list). Outputs: * (first item) and * (the remaining list).
When you'd reach for it
- Iteration / loop patterns - process one item per pass and feed the remainder back into the same branch. Pop → do work on the single item → loop the rest. ComfyUI doesn't have a native for-loop, so this is how you build one with the graph's own control flow.
- Batch peeling - take a single frame off the front of a batch and hand the rest to a different branch.
- Head/tail splits - first image as a reference, the rest as a sequence.
Installing it
# ComfyUI Manager → Install Custom Nodes → search "comfyui_davcha" → Install → Restart
# or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/dchatel/comfyui_davcha
cd comfyui_davcha
pip install -r requirements.txt
Pack-level note applies as always: the module imports llama_cpp and cv2 at load though requirements.txt only lists webp and rapidfuzz. Pack missing from your menu? pip install llama-cpp-python opencv-python and restart.
There's not much to troubleshoot on a node this small. The one thing to keep straight is the output polarity - first output is a single item, second is the leftover list - because mixing them up is the only way this bites you. Wire the list output back into the same Pop and you've got a real loop going.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| items | * | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| * | * | — |
| * | * | — |