-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
PR: Support for sets in the Variable Explorer #5230
PR: Support for sets in the Variable Explorer #5230
Conversation
Hello @Prikers! Thanks for updating the PR.
Comment last updated on September 20, 2017 at 20:02 Hours UTC |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @Prikers!, I tested locally and the cases you provided work as expected 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works as expected :-)
I think that sets should be editable, How difficult will be to edit sets? (I tried changing readonly to True, but I convert sets to lists.) |
@rlaverde sets cannot be edited by index:
So I don't think we really need to support anything beyond remove or adding items to it. |
@Prikers thanks for the work. Now, why does simple_set says |
But you could replace an element
I don't know how the internals of variable explorer works, and how easy something like this could be do it |
That is what I am suggesting, removing and adding is not the same as editing. And emulating that behavior (editing in place) is conceptually wrong and leads to believing they can be accessed by index. |
|
I understand the temptation to transform into a list, but I think we should not do this but generalize the concept for a set or even create a new editor just for handling sets, which is a non indexable non sorted, mutable container |
That's wise 😄 |
I think we should be able to use the collections editor. But instead of checking every time if it is a given object, I think it would be better to define characteristics for an object and act accordingly.
But what do you think @ccordoba12? |
I think what @Prikers has done is the best we can do for now. Before merging, I'd like to see these improvements :
|
None of our editors allow to add/remove new content to an object, so what @Prikers did (making the contents read-only) is the right thing to do for sets.
My plan for beta2 or beta3 is to use the multipledispatch library to define the behavior of several functions in the Variable Explorer according to the object's type. |
|
Exploring a bit more I noted a bug:
|
@Prikers, for now please finish your support for sets with my recommendations. Then you can open a new PR to fix the error you found and add support to add/remove elements to sets. |
Translations will be updated when we are about to release Spyder 4, to not ask our translators to constantly update a moving target (because we can add/remove a lot of translation strings during our betas). So, don't worry about this ;-) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work @Prikers! Thanks a lot for your contribution!!
Fixes #2355
set
is now a supported type in the variable explorer. Now I chose theQt.darkGreen
color as it was not already used for other objects: if that is not ok there are some other colors left 😄