How can I explicitly depend on all parameters?

The default behaviour for a method in a Parameterized class if it’s not decorated with @param.depends() is that it depends on all the parameters. If I decorate a method with @param.depends(on_init=True), it now depends on no parameters. How do I restore the default behaviour of depending on everything without explicitly passing a list of all my class’s parameters?

I see from Param.depends shorthand for "depends on all params" and Param.depends shorthand for “depends on all params” · Issue #380 · holoviz/param · GitHub that there is not a built-in way to do this (at least not including subobjects, although I don’t need that anyway). So does anyone have a pattern that they use for this effect?

Can’t you remove the depends and call the function from __init__?

The behaviour is not the same:

import param

class Foo(param.Parameterized):
    a = param.Parameter()

    @param.depends('a', on_init=True)
    def autozero(self):
        self.a = 0

class Bar(param.Parameterized):
    a = param.Parameter()

    def __init__(self, **params):
        super().__init__(**params)
        self.autozero()
    
    def autozero(self):
        self.a = 0    
        
foo = Foo()
print(foo.a)
# None
bar = Bar()
print(bar.a)
# 0

But anyway, the same question applies if I want to decorate a function with @param.depends(watch=True).

This trick of using method dependencies might work, assuming it doesn’t come with some kind of gotcha: Will this trick to collect parameter dependencies cause me unexpected trouble?