_.isBuiltinMethod
'is this a built-in method like str.upper?'
- obj
- *
_.isBuiltinMethod tells you whether a value is a Python built-in method - a method implemented in C that belongs to a built-in type, like "hello".upper, [1,2].append, or {}.keys. It's the sibling of _.isBuiltinFunction (for bare built-ins like len) and part of the same family of Python-type checks this pack ports.
How it works
Another exact-type test:
def isBuiltinMethod(self):
return self._wrap(type(self.obj) is BuiltinMethodType)
The fine line that matters here: a method you defined on your own class is MethodType. A built-in method attached to a built-in object is BuiltinMethodType. The check distinguishes the two precisely, so [1,2,3].append passes and a custom class's method fails.
The inputs that matter
One input, one output:
- obj - the primary input (
*), the value being inspected. Also accepts a_.CHAINto continue chaining.
Output is a single * - a real bool at runtime, untyped on the socket, since the auto-generator only types the standard Underscore.js method names.
Where you'd actually use it
Same honest answer as its sibling: this is introspection for meta-work, not a daily driver. To even hold a built-in method as a graph value, you'd be operating at the level where _.invoke is calling methods you fetched at runtime, or you're building iteratees from function-typed sockets. If you're in that rare territory, _.isBuiltinMethod lets you confirm what a value is before calling it - a poor-man's type guard. In an ordinary image or video workflow, it'll sit unused, and that's fine.
Installing
Part of 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 themselves - the bundled underscore3 port covers them.
Gotchas
Unset typed output (*), WIP status per the pack README, and a narrow definition: it checks BuiltinMethodType exactly, so it won't match plain functions, lambdas, or user-defined methods. If you want the broad "can I call this?" test, _.isCallable is the one; if you want "is it a built-in method specifically," this is it.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| objopt | * | Primary input object. Also accepts _.CHAIN to continue chaining. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| * | * | — |