8000 Fix `param.pprint` for `Array` parameters by replacing `all_equal` with `Comparator.is_equal` in `values()` by maximlt · Pull Request #795 · holoviz/param · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix param.pprint for Array parameters by replacing all_equal with Comparator.is_equal in values() #795

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

Merged
merged 3 commits into from
Jul 21, 2023

Conversation

maximlt
Copy link
Member
@maximlt maximlt commented Jul 21, 2023

Fixes #606
Fixes #179
Supersedes #437

I chose to replace all_equals in .param.values by Comparator.is_equal, which then needed to be extended to deal with objects that have the _infinitely_iterable attribute (Time). I've had to change the code in is_equal a little to fix the support for predicate: equality.

As a reminder (#179 (comment)), all_equal has this weird behavior that all_equal('aaaa', 'aa') is True. That behavior is relied upon (intentionally I guess) by .param.values(> so that the Parameterized instance auto-generated name is filtered out of the returned values. I copied code from #437 to make sure that this behavior is preserved. Because it's no longer used, I have deprecated all_equals.

#437 was discussing a bit more some API to decide whether you want to auto-suppress name or not. I have decided not to deal with that in this PR that is focused on fixing the linked issues.

#437 also discussed how to deal with comparing numpy arrays. As indeed if .param.pprint() now works with Array Parameters it will always include the default array, as the comparator doesn't handle this object type. I actually started to work on that and later realized this is a can of worms :)

@maximlt maximlt requested a review from jbednar July 21, 2023 00:15
Copy link
Member
@jbednar jbednar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thanks!

Co-authored-by: James A. Bednar <jbednar@continuum.io>
@maximlt maximlt merged commit bcf9a74 into main Jul 21, 2023
@maximlt maximlt deleted the pprint_allequal branch July 21, 2023 13:33
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.

Parameterized.param.pprint() hangs when param.Array parameter is present all_equal() is broken
3 participants
0