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

Default value not in .objects when check_on_set=False #693

Closed
maximlt opened this issue Mar 6, 2023 · 1 comment · Fixed by #794
Closed

Default value not in .objects when check_on_set=False #693

maximlt opened this issue Mar 6, 2023 · 1 comment · Fixed by #794
Labels
type-bug Bug report
Milestone

Comments

@maximlt
Copy link
Member

maximlt commented Mar 6, 2023

The docs on Selectors say:

If the list of available objects is not meant be exhaustive, you can specify check_on_set=False (which automatically applies if the initial list is empty). Objects will then be added to the objects list whenever they are set, including as the initial default.

However it's not quite true, I think, as I'd expect p.param.s.objects to contain the default value?

import param

class P(param.Parameterized):
    s = param.Selector(default=3, objects=[1, 2], check_on_set=False)

p = P()

print(p.s, p.param.s.objects)
# 3 [1, 2]
@maximlt maximlt added the type-bug Bug report label Mar 6, 2023
@maximlt maximlt added this to the 2.0 milestone Apr 5, 2023
@jbednar
Copy link
Member

jbednar commented May 12, 2023

Good catch; I think 3 should be put into the objects list in the above case.

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