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

Review of "maximum on dictionary returns max key instead of max val" #14672 #26744

Closed
fpmenninger opened this issue Apr 7, 2018 · 2 comments
Closed

Comments

@fpmenninger
Copy link

--
The original poster of #14672 asked for a function that would find the key of the minimum (or maximum) of the values in a dictionary.

In the last post before the issue was closed
JeffBezanson commented on Sep 14, 2017 commented:
findmax and indmax now do what the OP requests. If you want the maximum value, maximum(values(d))works. From there, I think it's simplest for maximum just to operate on iterators like it does now, so the behavior with pairs is strange but it's what falls out. I think the only possible further change from there is to change how Dicts iterate.

However while true for v0.7, this is not the case for v0.6

d = Dict('a'=>4, 'b'=>3, 'c'=>2, 'd'=>1)
findmin(d) # gives (1,'d') in v0.7, but ('a'=>4, 2) in v0.6
@JeffBezanson
Copy link
Member

Right, this is a breaking change that was made in 0.7 (master).

@fpmenninger
Copy link
Author

Will there be something similar to a deprecation notice in either version?

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

No branches or pull requests

2 participants