The following example will throw a ValueError because the x parameter is inheriting bounds from the superclass:
import param as pm
import panel as pn
pn.extension()
class A(pm.Parameterized):
x = pm.Magnitude(0.5)
class B(A):
x = pm.Integer(10)
pn.panel(B)
This can be solved by setting the bounds explicitly on class B:
import param as pm
import panel as pn
pn.extension()
class A(pm.Parameterized):
x = pm.Magnitude(0.5)
class B(A):
x = pm.Integer(10, bounds=(None,None))
pn.panel(B)
I would expect that this could additionally be solved by some usage of instantiate=True
or per_instance=True
, but I couldn’t find any usage of those arguments to resolve the behavior, and I don’t fully understand those parameter arguments.
Would you consider the observed behaviour a bug or is it expected and why? Can anyone share insight on the per_instance
and instantiate
parameter metadata? I don’t fully understand their usages after reading the documentation here: Parameters and Parameterized objects — param v1.13.0
Thanks!