You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The __call__ method could take an optional value that's used to set the reactive value, which would align Shiny for Python's reactive.value with R's reactiveVal(). This would reduce code switching costs for those of us who are used to R's pattern, without interfering with anyone who prefers the .get() and .set() methods approach.
The biggest challenge is likely typing, in particular because the .set() method returns True or False if it has triggered a reactive invalidation or resulted in a no-op. I propose we resolve this by having the __call__ method return either the new value (it'd be nice if we could do this invisibly, by which I mean in a way that doesn't print in Shiny Express) or nothing at all.
A
reactive.value
instance is a callable object, but the.__call__()
method is an alias for the reactive value's.get()
method.py-shiny/shiny/reactive/_reactives.py
Lines 120 to 121 in 33c8c79
The
__call__
method could take an optionalvalue
that's used to set the reactive value, which would align Shiny for Python'sreactive.value
with R'sreactiveVal()
. This would reduce code switching costs for those of us who are used to R's pattern, without interfering with anyone who prefers the.get()
and.set()
methods approach.The biggest challenge is likely typing, in particular because the
.set()
method returnsTrue
orFalse
if it has triggered a reactive invalidation or resulted in a no-op. I propose we resolve this by having the__call__
method return either the new value (it'd be nice if we could do this invisibly, by which I mean in a way that doesn't print in Shiny Express) or nothing at all.The text was updated successfully, but these errors were encountered: