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

Avoid clashing class_ slot in List parameter #456

Merged
merged 8 commits into from
Feb 16, 2021
Merged

Conversation

jlstevens
Copy link
Contributor

@jlstevens jlstevens commented Feb 8, 2021

Here is one way to address #455, namely to make sure the List parameter does not use the same class_ slot as ClassSelector (I called it list_class for now instead).

Generally, I'm not sure why parameters inherit previous slot values at all (when they have a value of None) tbh...

@jlstevens
Copy link
Contributor Author

This is probably the real issue: #97

@jlstevens
Copy link
Contributor Author

The tests are passing and this is a fairly simple workaround for #97. Even then, I would argue there is a difference between class_ in class selector and value_class for the values in collections (lists, sets, dicts etc) justifying a separate slot.

@philippjfr
Copy link
Member

I'd agree it justifies a different slot but as you say this is really a workaround for a deeper issue. Also not sure about list_class as the name, I'd suggest item_type but don't like that much more. In the long run I'd like towards making Parameters composable rather than having item_type-like slots.

@jlstevens
Copy link
Contributor Author

jlstevens commented Feb 9, 2021

Happy to rename to item_type and I also agree that a compositional model would be better for typing. After the renaming would you be happy with this PR (due to the difference in the slot semantics) or would you say #97 needs to be addressed instead (which is bound to be a much bigger job)?

@philippjfr
Copy link
Member

Maybe @jbednar has a better suggestion for the naming. I'd at least like to see class_ to be aliased properly so whatever new name we decide on is also accepted as a kwarg.

@jbednar
Copy link
Member

jbednar commented Feb 9, 2021

#97 does need addressing, but I agree it's a much larger job than putting in a workaround here, so we should do both. Regarding this specific workaround, I agree that the type for the items in a collection is semantically different than the type for a selector, so having a separate slot is very reasonable. The name item_type conveys to me that it's the type of the item and not of the collection, so I'm happy with that.

@jlstevens
Copy link
Contributor Author

@jbednar @philippjfr Happy with this workaround fix for now?

param/__init__.py Outdated Show resolved Hide resolved
param/__init__.py Outdated Show resolved Hide resolved
@philippjfr philippjfr merged commit cef8e34 into master Feb 16, 2021
@jlstevens
Copy link
Contributor Author

@philippjfr I see you've merged but what about Jim's point about pickling and __getstate__ needing updating?

@philippjfr
Copy link
Member

Missed that :/

sthagen added a commit to sthagen/holoviz-param that referenced this pull request Feb 19, 2021
Avoid clashing class_ slot in List parameter (holoviz#456)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants