Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

constant Parameter attribute not inherited #1001

Open
maximlt opened this issue Jan 2, 2025 · 2 comments · May be fixed by #1017
Open

constant Parameter attribute not inherited #1001

maximlt opened this issue Jan 2, 2025 · 2 comments · May be fixed by #1017
Labels
type-bug Bug report
Milestone

Comments

@maximlt
Copy link
Member

maximlt commented Jan 2, 2025

The constant Parameter attribute isn't correctly inherited in Parameterized subclasses. This was the behavior in Param 1 and somehow wasn't changed in Param 2.0. Seems like an oversight?

import param

class A(param.Parameterized):
    x = param.Parameter(1, constant=True)

class B(A):
    x = param.Parameter()

print(B.param['x'].constant)
# False

b = B()
b.x = 2

A sort of fortunate bug as that would considerably break Panel when it overrides name and doesn't set constant=False explicitly.

https://github.com/holoviz/panel/blob/d48c45f0606d407c833c02fb85c8fc03c9d9cde4/panel/widgets/base.py#L86

@jbednar
Copy link
Member

jbednar commented Jan 3, 2025

Yes, that seems like an oversight, probably mine. Apologies!

@maximlt
Copy link
Member Author

maximlt commented Jan 4, 2025

Or mine! Let's blame the test suite :)

@maximlt maximlt added this to the v2.3.0 milestone Feb 11, 2025
@maximlt maximlt linked a pull request Feb 11, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug Bug report
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants