Callback called before a method that is depended upon
- Dominant language
- Python
- Stars
- 521
- Forks
- 86
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 35
Description
The [Dependencies and Watchers](https://param.holoviz.org/user_guide/Dependencies_and_Watchers.html#dependency-specs) guide shows that you can depend on a _method_, as in the example below:
```python
import param
class D(param.Parameterized):
x = param.Number(0)
@param.depends('x', watch=True)
def cb1(self):
print(f"cb1 x={self.x}")
@param.depends('cb1', watch=True)
def cb2(self):
print(f"cb2 x={self.x}")
d = D()
d.x = 5
```
Output:
```
cb1 x=5
cb2 x=5
```
However, if you swap the declaration of `cb1` and `cb2`, `cb2` is called first while I would have expected `cb2` to always be called after `cb1`:
```python
import param
class D(param.Parameterized):
x = param.Number(0)
@param.depends('cb1', watch=True)
def cb2(self):
print(f"cb2 x={self.x}")
@param.depends('x', watch=True)
def cb1(self):
print(f"cb1 x={self.x}")
d = D()
d.x = 5
```
Output:
```
cb2 x=5
cb1 x=5
```
Contributor guide
Assessment
This issue has not been assessed yet.