hydra.overlay.python.util.lazy module

One-shot memoized thunk.

Mirrors hydra.util.Lazy from Hydra-Java. Holds a zero-argument callable; the first get() evaluates it and caches the result, subsequent get() calls return the cached value without re-evaluating.

Used by generated Python code wherever the kernel’s Haskell sources rely on lazy let semantics: a binding’s value is constructed once even when it is referenced multiple times, and is not evaluated at all when no use site is forced. The Java head emits new Lazy<>(...); Python emits Lazy(...).

class hydra.overlay.python.util.lazy.Lazy(fn: Callable[[], T])

Bases: Generic[T]

A one-shot memoizer for a zero-argument computation.

get() T