Skip to main content

lazy

Turn any callable into a lazy evaluated callable. result classes or types is required -- at least one is needed so that the automatic forcing of the lazy evaluation code is triggered. Results are not memoized; the function is evaluated on every access.

def lazy(
func: callable,
*resultclasses: type
) - > function

Turn any callable into a lazy evaluated callable. result classes or types is required -- at least one is needed so that the automatic forcing of the lazy evaluation code is triggered. Results are not memoized; the function is evaluated on every access.

Parameters

NameTypeDescription
funccallableThe function or callable to be wrapped for lazy evaluation.
*resultclassestypeOne or more classes or types that the lazy object is expected to mimic; used to determine which methods should trigger evaluation.

Returns

TypeDescription
functionA wrapped version of the original function that returns a proxy object instead of the actual value.