Nodes/ComfyUI-LogicUtils/Pyobjects/Cast to SET
ComfyUI Node

Pyobjects/Cast to SET

Dedupe a value into a Python set

By aria1th·Created 3 years ago·Updated 7 months ago· 116
Pyobjects/Cast to SET
  • py_obj
  • SET

This node takes whatever comes in on its wildcard input and forces it into a Python set - think set(py_obj) in your head. The practical effect: duplicates disappear and order stops being guaranteed. If you feed it a list with repeated entries, what comes out has each unique value exactly once, in whatever order Python's set implementation happens to store them in - which is not necessarily the order you put them in.

It's the sibling of Pyobjects/Cast to LIST in aria1th's ComfyUI-LogicUtils pack - a small collection of logic, random-number, and data-plumbing utility nodes. Same GitHub account that trained the Illustrious XL checkpoints under the AngelBottomless handle, though this pack is unrelated work and has been quiet since a last push on 2026-01-21.

Inputs and outputs

  • py_obj - any value, typed as the wildcard *.
  • Output - a single SET.

No configuration beyond that - it's a pure type cast.

It's also flagged as an output node in ComfyUI's terms, so it executes even without anything wired downstream from it. That's useful while you're building a graph and just want to confirm a cast worked, though a raw set doesn't render as a rich preview - it's confirmation of plumbing, not a visual output.

Where you'd actually use it

This is squarely for people building more programmatic, Python-object-flavored ComfyUI graphs rather than standard image pipelines - deduplicating a collection of values (a list of tags, choices, or identifiers gathered elsewhere in the graph) before passing it to something that needs unique entries, or converting a value into the SET type specifically because a downstream node's socket expects it rather than the permissive * wildcard most of this pack passes around. If you landed here from a "missing node" error on a shared workflow, that workflow is doing something more custom than a typical txt2img graph - worth knowing before you go digging for what it's for.

Installing it

ComfyUI Manager → search ComfyUI-LogicUtils → install → restart. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/aria1th/ComfyUI-LogicUtils

No model files, and reportedly no real dependencies - a r/StableDiffusion thread comparing lightweight logic options in ComfyUI recommended this exact pack over heavier, less-maintained ones (WAS Node Suite, Impact Pack) for having none. The README's auto-install hook stays off by default (COMFYUI_LOGICUTILS_AUTO_INSTALL=1 to enable it, COMFYUI_LOGICUTILS_SKIP_INSTALL=1 to force it off).

Common issues

Two things catch people out with sets generally, and both are inherent to Python's set type rather than anything specific to this node: order isn't preserved, so don't rely on the output coming back in the same sequence you fed it, and every element has to be hashable - a set of plain strings or numbers is fine, but if py_obj contains something unhashable (like a nested list), the cast will fail. If you need order preserved or don't need deduplication, use the companion Pyobjects/Cast to LIST node instead. As with the rest of this pack, expect stability but not active maintenance - the last push was January 2026.

CategoryData

Inputs (1)

NameTypeDefaultDescription
py_obj*

Outputs (1)

NameTypeDescription
SETSET