-
-
Notifications
You must be signed in to change notification settings - Fork 81
Closed
Labels
type-featureFeature requestFeature request
Milestone
Description
Right now, len(x) on a reactive expression gives an error even on objects that do have a length:
from param import rx
l = rx([1,2,3])
print(l.rx.len())
len(l)TypeError: object of type 'rx' has no len()
I believe we can't implement __len__ reactively, but can't we provide a better error message in this case? E.g. it seems like we could print a warning saying that the value returned won't be reactive (and what to do instead (.rx.len()), and then return the non-reactive length.
I'm not sure if there are any other such methods where we can similarly help guide the rx user towards correct code with less pain.
Metadata
Metadata
Assignees
Labels
type-featureFeature requestFeature request