Nodes/comfy-ovum/_.difference
ComfyUI Node

_.difference

Everything in list A that isn't in list B

By sfinktah·Created about a year ago·Updated 10 months ago· 7
_.difference
  • py_list
  • others
  • LIST

_.difference is set subtraction for the graph: it returns the values from your first list that are not present in any of the other lists you give it. The author's description: "Similar to without, but returns the values from array that are not present in the other arrays." Where _.without removes specific known values, _.difference removes everything that lives in another list - which is how you say "give me the items that only exist here."

Think: "which of these model files aren't in the approved list?", "which prompts failed against the blacklist?", "what's new in this list compared to the last run's list?" If a workflow is diffing two versions of a batch, this is the node.

How it works

Generated wrapper around underscore3, the bundled Python port of Underscore.js. Semantics:

  • The output contains every element of the first list that does not appear in any of the other lists.
  • Order is preserved from the first list.
  • The others input is the flexible one - the tooltip says JSON is allowed, and for multiple values you provide a JSON array (e.g. [1,2,3]). So you can wire a single list, or a JSON array of lists, as the "exclude" set.

_.difference([1, 2, 3, 4], [2, 4])[1, 3]. Straightforward.

Inputs and output

  • py_list (any type) - the source list, the "keep everything here" side.
  • others (any type) - the exclusion list(s); JSON array for multiple.
  • Output: LIST - the items unique to the first list, in original order.

Installing it

Part of sfinktah/comfy-ovum ("comfy-ovum"):

  • ComfyUI Manager: search "comfy-ovum", install, restart.
  • Manual: cd ComfyUI/custom_nodes && git clone https://github.com/sfinktah/comfy-ovum, restart.

No model downloads; light dependencies; underscore3 bundled in the repo.

Where it bites

Equality is Python equality, so 1 and 1.0 are treated as the same value, and string matching is exact and case-sensitive. If your lists mix types or have case differences, normalize before you diff, or "differences" you expected to show up will vanish. Also keep the pack's standing caveat in mind: the underscore family is flagged as work-in-progress in the README. For quick "what's unique here" checks it's great; for anything that makes a real decision, verify the result once with a known input before trusting it.

Categoryovum/underscore

Inputs (2)

NameTypeDefaultDescription
py_listopt*Primary input object (expected array). You can still pass any JSON-serializable value. Also accepts _.CHAIN to continue chaining.
othersopt*others: JSON allowed for arrays/objects where applicable. For multiple values, provide a JSON array (e.g., [1,2,3]).

Outputs (1)

NameTypeDescription
LISTLIST