param.Dynamic#
- class param.Dynamic(default=None, *, doc=None, label=None, precedence=None, instantiate=False, constant=False, readonly=False, pickle_default_value=True, allow_None=False, per_instance=True, allow_refs=False, nested_refs=False)[source]#
Parameter whose value can be generated dynamically by a callable object.
If a Parameter is declared as Dynamic, it can be set a callable object (such as a function or callable class), and getting the parameter’s value will call that callable.
Note that at present, the callable object must allow attributes to be set on itself.
If set as time_dependent, setting the Dynamic.time_fn allows the production of dynamic values to be controlled: a new value will be produced only if the current value of time_fn is different from what it was the last time the parameter value was requested.
By default, the Dynamic parameters are not time_dependent so that new values are generated on every call regardless of the time. The default time_fn used when time_dependent is a single Time instance that allows general manipulations of time. It may be set to some other callable as required so long as a number is returned on each call.
- __init__(default=None, *, doc=None, label=None, precedence=None, instantiate=False, constant=False, readonly=False, pickle_default_value=True, allow_None=False, per_instance=True, allow_refs=False, nested_refs=False)[source]#
Call the superclass’s __init__ and set instantiate=True if the default is dynamic.
Methods
__init__
([default, doc, label, precedence, ...])Call the superclass's __init__ and set instantiate=True if the default is dynamic.
deserialize
(value)Given a serializable Python value, return a value that the parameter can be set to
schema
([safe, subset, mode])serialize
(value)Given the parameter value, return a Python value suitable for serialization
Attributes
allow_None
allow_refs
constant
default
doc
instantiate
label
name
nested_refs
owner
per_instance
pickle_default_value
precedence
readonly
rx
The reactive namespace.
time_dependent
time_fn
watchers