Where to use `param.rx`

Hi @LecrisUT, just found your post. I just made a recent post here that I think is running into the same problems. For more complicated pipelines of calculations, I’m also finding that just writing a function and binding it to be more transparent and predictable.

On the param documentation, they write:

Enter param.bind, which allows you to define functions that are automatically invoked when their input Parameters change. This serves as a bridge between the reactive rx model and the lower-level ‘push’ model. Unlike the ‘push’ model, where you would explicitly set up watchers and callbacks, param.bind simplifies the process by letting Param manage the mechanics, but also making the dependencies more transparent than in a purely rx approach.

In essence, param.bind offers the declarative nature of reactive expressions and the explicitness of the ‘push’ model. This makes it particularly useful for complex applications where you might want the clarity of explicit function calls for key parts of your pipeline, but also wish to retain the high-level, declarative relationships offered by reactive expressions.

From working with .rx() so far, it seems like great syntactic sugar, wherever the desired operations are supported. But for doing operations on more complicated data structures (list, dict, df), it’s easy to run into situations that the rx() doesn’t natively support (e.g. setting an item in a dictionary doesn’t seem to push updates reactively, while setting an entire dictionary does).

1 Like