Cannot change instance attributes with a Callable without passing in parameterized class
- Dominant language
- Python
- Stars
- 521
- Forks
- 86
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 35
Description
**Problem**:
Param callables do not work as expected given the purpose of the parametrized class.
Per the documentation, the purpose of the callables is partly to modify the attributes of the class.
> Invocation parameters are a loose group of types that either contain an executable (callable) object, are invoked to execute some other code, or are set to change the value of some other parameter(s) or attribute(s).
Instead of having to pass `self` to the instance like so
```python
class ExpEnv(param.Parameterized):
url_input = param.String('test')
url_list = param.List([])
url_submit = param.Action(lambda self: self.url_list.append(self.url_input))
ee = ExpEnv()
ee.url_submit(ee)
ee.url_list
```
output: ```['test']```
it would be preferable to simply call the `test_class.fn()` where it implicitly passes `self` within the parameter creation like so:
```python
ee.url_submit()
```
This makes more sense, given that the intent of the callable is to modify the attributes of the instance.
#### Additional context
Discourse discussion: https://discourse.holoviz.org/t/how-does-param-action-callable-handle-passing-self-to-function-unexpected-behavior-in-conjunction-with-panel/6665
Contributor guide
Assessment
This issue has not been assessed yet.