Skip to content

Rename findmin and findmax? #24865

@nalimilan

Description

@nalimilan

findmin and findmax return a tuple with the index of the maximum/minimum, and the corresponding value. This behavior is kind of inconsistent with find, findfirst, findlast, findnext and findprev, which return indices without values. On the other hand, indmin and indmax return only the indices.

It would be more consistent to rename indmin/indmax to findmin/findmax. Of course this is not possible in a single deprecation cycle. I can see two solutions:

  • Deprecate findmin and findmax in 0.7, and rename indmin and indmax to findmin and findmax in 1.0. This has the drawback of breaking things between 0.7 and 1.0.
  • Rename indmin and indmax to findmin and findmax in 0.7. This introduces breaking changes in 0.7, but at least there wouldn't be any changes in 1.0.

Finally, it's not clear to me whether we really need the current behavior of findmin/findmax, compared with getting the index and then extracting the corresponding element manually. The performance gain should only be significant for very small collections AFAICT.

Metadata

Metadata

Assignees

No one assigned

    Labels

    search & findThe find* family of functions

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions