List Info
Count, first, last — the three things you'll want to know about a list
- input_list
- count
- first_item
- last_item
When a workflow hands you a list, the first three questions are always the same: how many items, what's at the start, what's at the end. List Info answers all three with zero configuration. It's the node you drop on a list to find out what you're actually dealing with - before you filter it, slice it, or feed it somewhere that assumes it's non-empty.
It's part of DebugPadawan's ComfyUI Essentials, a small MIT-licensed utility pack with a whole family of list nodes. This one is the diagnostic.
How it works
No config, just read: len(input_list) becomes count, str(input_list[0]) becomes first_item, str(input_list[-1]) becomes last_item. Empty list gets the sensible special case of (0, "", "") rather than an error.
One detail worth flagging: first_item and last_item come out as STRINGS, not as the items' original types. If your list holds numbers, you get "42" (the text), not 42 (the number). Great for display and for string branching; a foot-gun if you meant to feed the value back into a numeric input.
Inputs and outputs
- input_list - the LIST to inspect.
Outputs:
- count - INT, number of elements. Zero means the list is empty - your early-warning signal.
- first_item - STRING, the first element.
- last_item - STRING, the last element. For a single-item list these are the same.
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.
Where it earns its keep
- Empty-list detection. Compare
countto zero (a Number Compare or Logic Gate) and branch the workflow before it chokes on nothing. - Validating upstream list nodes. Run it after a List Filter or List Slicer to confirm the count matches what you expected - the fastest way to catch a filter that matched nothing.
- Boundary values. The
first_item/last_itemare handy when you need the extremes of a list without indexing into it yourself.
The honest limitation: it tells you about edges and size, not content. For "does this list contain X," you want List Filter in contains mode instead.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| input_list | LIST | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| count | INT | — |
| first_item | STRING | — |
| last_item | STRING | — |