Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't use names=traitlets.All in observe #3193

Closed
ianhi opened this issue May 3, 2021 · 2 comments
Closed

Don't use names=traitlets.All in observe #3193

ianhi opened this issue May 3, 2021 · 2 comments

Comments

@ianhi
Copy link
Contributor

ianhi commented May 3, 2021

Problem

We use observe inherited from traitlets.HasTraits which uses names=traitlets.All as a default argument. This can have confusing effects for anyone who wants to manually observe a widget. For example see #3192

My sense is that for most of the core widgets people really only want to observe the value trait so it's a bit unnecessary to always have to do slider.observe(callback, names='value') or to add an if statement to the callback.

Proposed Solution

Override observe for the widget classes to give a default argument for names that is curated for the widget being used. So for example for an IntSlider we would change the default to be value.


Marking as 8.0 due to back incompat.

@jasongrout
Copy link
Member

In our dev meeting today, we discussed this and think that probably it would be too big of a change? Do you have a nice elegant solution we could look at?

@vidartf
Copy link
Member

vidartf commented Aug 10, 2021

Closing for now.

@vidartf vidartf closed this as completed Aug 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants