Nodes/comfy-ovum/_.isMethod
ComfyUI Node

_.isMethod

A bound-method spotter for a world that never sends them

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

_.isMethod checks whether an object is a Python bound method - the kind of thing you get when you write some_object.some_method and grab the method off the instance, which bundles the instance with the function. It's from the sfinktah/comfy-ovum pack's ovum/underscore family, the auto-generated wrappers around underscore3 (a Python port of Underscore.js). The check itself is fine: it uses inspect.ismethod(), which is the standard, correct way to detect a bound method. The problem is purely one of relevance - nothing in a normal ComfyUI workflow is handing out bound methods.

The README's family warning - work in progress, "not recommended for use in workflows" - is really aimed at the relevance problem more than correctness. This node is technically sound and practically pointless.

What it does

inspect.ismethod(obj) returns True for bound methods (functions accessed through an instance, carrying the instance as self) and False for:

  • Plain functions (def at module level) - those are FunctionType, not methods.
  • lambdas.
  • Built-in methods (those are BuiltinMethodType, a different type).
  • Static/class methods accessed in ways that don't bind an instance.

So it's a precise, narrow question: "is this a function attached to an instance?" For that question it's the right tool. It's just that the graph environment almost never contains such objects. To get a bound method onto a wire you'd need a custom node that returns some_instance.some_method - a niche of a niche.

Like the rest of the family, it takes a plain value and returns the boolean, or takes a _.CHAIN from _.chain and keeps the chain going.

Inputs and outputs

  • obj - the only input, type *, optional.
  • Output - a single * socket holding a Python bool (the family's generic-typed output quirk).

Where it fits

Debugging exotic object plumbing, and that's about it. If you're ever introspecting what a custom node actually returned - say you wired a node that claims to output a "function" and you're not sure what form it took - _.isMethod tells you whether it's an instance-bound method versus a plain function (_.isFunction) or a lambda (also _.isFunction). That trio of checks can identify any callable shape, which is the only real use for this node.

Installing it

Install the pack via ComfyUI Manager - search comfy-ovum - or:

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

Restart ComfyUI. No extra dependencies; underscore3 is bundled in the repo.

Gotchas

  • It detects bound methods only - plain functions, lambdas, and built-in methods all read as False.
  • For identifying callables in general, _.isFunction is the broader and more useful check.
  • Output wire is *, not BOOLEAN.
Categoryovum/underscore

Inputs (1)

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

Outputs (1)

NameTypeDescription
**