memo module#

Memoization decorators#

This module provides decorators for enabling and disabling memoization on structural classes to optimize object creation. Generally users will not interact directly with these decorators, as the effects of them can be unintuitive.

memoize(cls)[source]#

Decorator to enable memoization on this class and its subclasses. This is the default for many structural elements and doesn’t need to be explicitly added.

Return type:

type[TypeVar(T, bound= Structural)]

Parameters:

cls (type[T])

dememoize(cls)[source]#

Decorator to disable memoization on this class and its subclasses. This is useful if the object is reactive and changes based on the context in which it’s being used, and thus cannot be memoized based on its arguments.

Return type:

type[TypeVar(T, bound= Structural)]

Parameters:

cls (type[T])