Nodes/comfy-ovum/_.isCallable
ComfyUI Node

_.isCallable

The one Python type-check in this family that's actually broadly useful

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

_.isCallable answers a broad, genuinely useful question: can you call this value? It's Python's callable() exposed as a node. A function? Callable. A lambda? Callable. A class? Callable (calling it constructs an instance). A number, string, or list? Not callable. Where the pack's other type-checks split hairs between built-in functions, built-in methods, lambdas, and classes, this one asks the only question that usually matters: will x(...) work?

How it works

The port is a one-liner wrapper around Python's own callable:

def isCallable(self):
    return self._wrap(callable(self.obj))

Because it delegates to callable(), it inherits Python's nuanced definition - classes count, and instances with a __call__ method count too. That makes it the practical "function-or-function-like" test of the family.

The inputs that matter

One in, one out:

  • obj - the primary input (*), the value being inspected. Also accepts a _.CHAIN to continue chaining.

Output is a single * - a real bool at runtime, but untyped on the socket because the auto-generator only gives typed outputs to the standard Underscore.js method names.

Where you'd actually use it

This is the type-check in the family with real workflow legs, and the recipe is defensive: the pack's _.invoke will happily try to call whatever you pass as its methodName, and UnderscoreExports can hand you live callables as PY_FUNC values. Before you route a mystery value into something that calls it, a _.isCallable guard tells you whether the call will even fly - and lets you branch to a fallback instead of watching the workflow log a TypeError.

It's also handy when you're normalizing data from sources that can't tell functions from values. You don't need it every day, but when you need it, there's no vanilla ComfyUI equivalent.

Installing

Ships in comfy-ovum (MIT). ComfyUI Manager → search comfy-ovum → install → restart, or:

cd ComfyUI/custom_nodes
git clone https://github.com/sfinktah/comfy-ovum

No extra dependencies for the underscore nodes - the bundled underscore3 port handles them. (Pack-wide requirements.txt includes pymediainfo, which wants system libmediainfo on Linux, but that's unrelated to this node.)

Gotchas

Remember it's an exact callable() test, not a type check - a string that looks like a function name still returns false, and a class returns true. And the standard pack caveat stands: the underscore family is WIP and author-flagged as not for production. For a guard on a debugging graph or a data-normalization step, it's a solid, boring utility.

Categoryovum/underscore

Inputs (1)

NameTypeDefaultDescription
objopt*Primary input object. Also accepts _.CHAIN to continue chaining.

Outputs (1)

NameTypeDescription
**