Nodes/comfy-ovum/_.symmetric_difference
ComfyUI Node

_.symmetric_difference

The elements that live in exactly one list

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

_.symmetric_difference takes two collections and returns everything that appears in exactly one of them - the classic set operation, A ⊕ B. [1,2,3] vs [2,3,4][1,4]. The 2s and 3s cancel out because they're in both; the 1 and the 4 survive because each lives in only one place. It's the "what's genuinely different between these two sets" check.

It's part of the ovum/underscore family in comfy-ovum - auto-generated wrappers around underscore3, the Python port of Underscore.js bundled in the pack - and it carries the family's explicit WIP warning from the author ("not recommended for use in workflows"). This one's a little rougher than most: the method docstring literally has a # TODO: fancy set way comment in the implementation, and it builds the result by iterating values and union-ing, so it works on lists, sets, and dict values rather than being a true set-type operation.

Why you'd use it

Diffing is genuinely useful in workflows. Compare the list of tags a wildcard processor produced against a baseline list to find what changed. Compare two filename lists to find files that are in one but not the other. Compare installed model names against a reference list. Whenever you need "what's unique to each side," this is the node. If you only wanted A minus B (elements in A but not B), you want _.difference from the same family instead - symmetric difference is the both-directions version.

Inputs and output

  • obj (*) - the first collection.
  • other (*) - the second collection. JSON allowed for arrays/objects where applicable.

Output is a single * carrying the symmetric difference as a list. Family behavior applies: pass a _.CHAIN in as obj and the node continues the chain, returning a chain to unwrap 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 in the repo. One honest caveat before you build on it: the implementation iterates values, so a dict gets diffed by its values, and order of the result isn't guaranteed to match either input's order. For anything where the exact ordering matters downstream, run the result through _.sort or _.sortBy before you use it.

Categoryovum/underscore

Inputs (2)

NameTypeDefaultDescription
objopt*Primary input object. Also accepts _.CHAIN to continue chaining.
otheropt*other: JSON allowed for arrays/objects where applicable.

Outputs (1)

NameTypeDescription
**