holoviz/param

Default value not in `.objects` when `check_on_set=False`

Closed this issue · 1 comments

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]

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