param.ParameterizedFunction.instance#

ParameterizedFunction.instance(**params)[source]#

Create and return an instance of this class.

This method returns an instance of the ParameterizedFunction class, copying parameter values from any existing instance provided or initializing them with the specified params.

This method is useful for obtaining a persistent object representation of a ParameterizedFunction without triggering its execution (__call__).

Parameters:

**params (dict) – Parameter values to initialize the instance with. If an existing instance is used, its parameters are copied and updated with the provided values.

Returns:

An instance of the class with the specified or inherited parameters.

Return type:

ParameterizedFunction

References

See https://param.holoviz.org/user_guide/ParameterizedFunctions.html

Examples

Create an instance with default parameters:

>>> import param
>>> class Scale(param.ParameterizedFunction):
...     multiplier = param.Number(default=2, bounds=(0, 10), doc="The multiplier value.")
...
>>> instance = Scale.instance()
>>> instance.multiplier
2

Use the instance:

>>> instance(5)
10