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

Subobject dependencies should be dynamic #410

Closed
philippjfr opened this issue May 14, 2020 · 3 comments · Fixed by #533
Closed

Subobject dependencies should be dynamic #410

philippjfr opened this issue May 14, 2020 · 3 comments · Fixed by #533
Labels
type-feature Feature request
Milestone

Comments

@philippjfr
Copy link
Member

The param.depends decorator supports expressing dependencies on parameters on subobjects. However these dependencies are evaluated only on initialization meaning that if the object is not yet defined then it will error and if it is redefined later it will not set up that dependency. The following example should work but currently errors:

import param

class A(param.Parameterized):
    
    value = param.Parameter()
    
class B(param.Parameterized):
    
    a = param.ObjectSelector()
    
    @param.depends('a.value', watch=True)
    def test_depends(self):
        print(self.a.value)

b = B()
b.a = A()
b.a.value = 1
@philippjfr philippjfr added the type-feature Feature request label May 14, 2020
@jbednar
Copy link
Member

jbednar commented May 14, 2020

I guess whether this is a bug or a requested feature depends on your outlook on life. :-) Seems like you're coming down on the side of "possible feature" given that it wasn't part of the original design, but I agree that it should behave properly in that case, making it also kinda be a bug...

@philippjfr
Copy link
Member Author

Agreed, I clicked on feature request but then almost decided to change the label.

@ceball
Copy link
Member

ceball commented May 15, 2020 via email

@kcpevey kcpevey added this to the v1.10.0 milestone Jun 29, 2020
@ablythed ablythed modified the milestones: v1.10.2, v1.10.3 Jun 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-feature Feature request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants