Nodes/comfy-ovum/_.isBuiltinFunction
ComfyUI Node

_.isBuiltinFunction

'is this a built-in like len() or print()?'

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

_.isBuiltinFunction checks whether a value is a Python built-in function - the C-implemented ones like len, print, range, map. It's part of the pack's collection of Python-flavored type checks, added because this port of Underscore.js swapped JavaScript's type system for Python's and needed isFunction-style tests that map onto actual Python types.

How it works

The check is about as literal as it gets:

def isBuiltinFunction(self):
    return self._wrap(type(self.obj) is BuiltinFunctionType)

It compares the object's exact type against BuiltinFunctionType from the types module. That's a narrow, precise test: a normal function you defined yourself is FunctionType, not BuiltinFunctionType, and fails this check. lambda is LambdaType and fails too. Only the interpreter's built-ins pass.

The inputs that matter

Just one:

  • obj - the primary input (*), the value being inspected. Also accepts a _.CHAIN to continue chaining (you get the chain back, per the chaining contract).

Output is a single * - a real Python bool at runtime, but untyped on the socket, because the generator's lookup table only recognizes standard Underscore.js method names and this one isn't one. Same story as _.isBool, if you've met that node.

Where you'd actually use it

Honestly? Rarely. To have a built-in function floating through your graph as a value, you'd have to be doing fairly deep meta-work - pulling callables out of a function-typed socket, or building iteratees via the pack's UnderscoreExports ("underscore function") node, which hands you the _ factory itself as a PY_FUNC. If you're in that territory, _.isBuiltinFunction and its siblings (_.isBuiltinMethod, _.isCallable, _.isClass) become a way to introspect what you've actually got before you try to call it. For a typical image workflow, you'll never need it.

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

Underscore nodes need no extra dependencies - the bundled underscore3 port handles them.

Gotchas

The output being untyped (*) means ComfyUI won't validate downstream connections for you, and the pack README's standard warning - underscore family is WIP, not for production - applies in full. It's a debugging introspection tool, not pipeline material. Use it when you're confused about what a value is; ignore it otherwise.

Categoryovum/underscore

Inputs (1)

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

Outputs (1)

NameTypeDescription
**