posit-dev / posit-dev/py-shiny
reactive.Value should ignore spurious sets
@jcheng5 is already working on this.
Since Jun 9, 2022.
- Dominant language
- Python
- Stars
- 1.8k
- Forks
- 135
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 21
Description
In R, setting a reactive value that is identical() to the existing value, results in the set being ignored. In Python, the same logic is implemented using is (object identity equality). This is different than value equality in the case of even some base types (strings, floats) and certainly any composite types.
However, using == is problematic also; for numpy and pandas, it means elementwise comparison and returns an iterable of bools. One approach would be to iterate over those bools, but that wouldn't detect differences in some types of metadata (e.g. pandas indices, maybe?).
Currently, the only place where we absolutely need equality comparison (that I know of) is the forthcoming reactive.poll. We could change reactive.value to never dedupe (or to dedupe only if opted in by providing a comparison function) and demand that reactive.poll user-provided check functions return simple data types.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.