ComfyUI Node

_.tail

Drop the first item, keep the rest

By sfinktah·Created about a year ago·Updated 10 months ago· 7
_.tail
  • obj
  • *
indextrue

_.tail returns everything except the first entry of a list. [0, 1, 2, 3][1, 2, 3]. In real Underscore.js, tail is literally an alias of rest, and this Python port keeps that: tail = rest. So if you're reading this because you searched for _.tail and found it identical to _.rest - yes, that's by design. Same implementation, same quirks, one different name on the canvas.

Why bother having both? Because "drop the first element" reads better as tail in some contexts, and old Underscore muscle memory searches for both names. If you're dropping a header row, a seed value, or the first frame reference from a list, either node works.

It's part of the ovum/underscore family in comfy-ovum - auto-generated wrappers around underscore3, the bundled Python port of Underscore.js - and it inherits the family's honest label: work in progress, not recommended for production. The wrapper deep-copies your input, so your source list is never mutated. That's the nice part. The rough part is the index widget, and it's the same story as _.rest.

The input that's a trap

  • obj (*) - the list. Expects an array; the socket is typed * so it won't reject anything, it'll just slice whatever you give it.
  • index (BOOLEAN, default true) - in proper Underscore, rest(list, index) lets you start the slice anywhere: rest([1,2,3,4], 2)[3,4]. Here the auto-generator saw the default index=1, and because Python's 1 == True, it built a boolean widget. So you effectively get "slice from 1" (drop one) or, if you flip it to false, "slice from 0" (keep everything). There's no way to drop, say, the first three items through this widget. If you need that, use the pack's ListSlice node, which has proper integer start/end.

Output is a single * socket with the rest of the list. Family chain behavior: feed a _.CHAIN in as obj and it returns a chain, unwrapped later with _.value.

Install

# via ComfyUI Manager: search "comfy-ovum"
cd ComfyUI/custom_nodes
git clone https://github.com/sfinktah/comfy-ovum
# restart ComfyUI

No model downloads; pure Python, deps (aiohttp, pillow, numpy, requests, etc.) via Manager, underscore3 bundled. If your workflow loads _.tail from someone else's graph and drops more than one item unexpectedly, check whether it's actually feeding a value into index - a stray true there is the classic cause, and it's the sort of footgun that makes the author's "don't use these in production" warning feel well-earned.

Categoryovum/underscore

Inputs (2)

NameTypeDefaultDescription
objopt*Primary input object. Also accepts _.CHAIN to continue chaining.
indexoptBOOLEANtrueindex (boolean)

Outputs (1)

NameTypeDescription
**