Add an on_None argument to the depends decorator
- Dominant language
- Python
- Stars
- 521
- Forks
- 86
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 35
Description
Often I have methods that depend on a parameter and then use that parameter value to do something. Rather than having logic in all of my methods to test if that parameter is `None` it would be nice to just not have the method trigger if the parameter value is `None`.
For example:
```python
class Test(param.Parameterized):
d = param.Dict()
@param.depends('d', watch=True, on_init=True)
def len_d(self):
print(len(self.d))
t = Test()
```
Running this code causes the following error:
```
TypeError: object of type 'NoneType' has no len()
```
I would love to have an `on_None` argument to the `depends` decorator that will not trigger the function if the value of the parameter that it depends on is `None`.

Contributor guide
Assessment
This issue has not been assessed yet.