Nodes/comfy-ovum/_.isLambda
ComfyUI Node

_.isLambda

The misnomer that agrees with isFunction on everything

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

_.isLambda claims to check whether an object is a lambda - an anonymous function created with Python's lambda keyword. It's part of the sfinktah/comfy-ovum pack's ovum/underscore family, the auto-generated wrappers around underscore3 (a Python port of Underscore.js). And here's the thing about that claim: in CPython, it's not actually true in a useful way, because lambdas and ordinary functions share a type.

The family's README warning is the standard one - work in progress, "not recommended for use in workflows" - and this node is a decent example of why the warning exists. The behavior isn't broken; it's just not what the name implies.

What it does

The implementation checks type(self.obj) is LambdaType. And in CPython, types.LambdaType is literally the same object as types.FunctionType - the standard library defines one as an alias of the other. So this check is byte-for-byte identical to _.isFunction:

  • Any function created with defTrue.
  • Any function created with lambdaTrue.
  • Built-in functions (BuiltinFunctionType) → False.
  • Anything callable-but-not-a-function, like a class or a __call__ instance → False.

So _.isLambda cannot distinguish a lambda from a def-ined function, because Python doesn't record which syntax created a function. The name promises more than the language can deliver. If your mental model was "this node spots lambdas specifically," discard it - it spots functions, full stop.

The only real-world scenario where this node matters: some custom node packs accept function objects as inputs (this very family's iteratee nodes take callables), so if you're plumbing functions through a graph and want to confirm what's on the wire, _.isLambda and _.isFunction are interchangeable.

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 workflows that pass callables around, and not much else. If you're not plumbing function objects through a graph - which is most people - this node is decorative. It exists because the underscore3 library has an isLambda method and the generator wrapped every method it found. That's the whole story.

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 vendored in the repo.

Gotchas

  • Lambdas and def functions are the same type in CPython, so _.isLambda says True for both - it can't tell them apart.
  • It agrees with _.isFunction on every input.
  • Output wire is *, not BOOLEAN.
Categoryovum/underscore

Inputs (1)

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

Outputs (1)

NameTypeDescription
**