holoviz / holoviz/param

`allow_None` not enforced when set to `False` and the default value is `None`

Open
#870 2 comments 1 reaction 0 assignees View on GitHub
type-bug
Dominant language
Python
Stars
521
Forks
86
Avg merge
1d 13h
Merged PRs (30d)
35

Description

Setting `allow_None` to `False` when the `default` Parameter value is `None` automatically sets it to `True`. I believe Param shouldn't be doing that, when `allow_None` is explicitly set to `False` this value should be enforced. The annoying bit being that for Parameters whose default `default` value is `None` (like `Callable` below) you'd have to provide a value that is not `None`. Unless this applies only after the Parameter has been instantiated, to allow it to be instantiated with `None` as the value for `default` with `allow_None=False`, but preventing it to be set to `None` afterwards, which I believe is what you can do now with `ObjectSelector`.

```python
import param

class A(param.Parameterized):
c = param.Callable(allow_None=False)

print(A.param.c.allow_None)
# True!
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.