8000 Slight inaccuracy in the `partition` docstring. · Issue #7958 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

Slight inaccuracy in the partition docstring. #7958

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

Closed
WarrenWeckesser opened this issue Aug 21, 2016 · 2 comments · Fixed by #22149
Closed

Slight inaccuracy in the partition docstring. #7958

WarrenWeckesser opened this issue Aug 21, 2016 · 2 comments · Fixed by #22149

Comments

@WarrenWeckesser
Copy link
Member

The docstring for the partition method says:

All elements smaller than the kth element are moved before this element and
all equal or greater are moved behind it.

That's not quite correct, because some of the elements before the kth element could be equal to the kth element. A trivial example is an input containing all the same values. Perhaps a better wording is something like:

In the partitioned array, all elements before the `kth` element are less than or
equal to that element, and all the elements after the `kth` element are greater than
or equal to that element.
@WarrenWeckesser
Copy link
Member Author

On reading it again, I see that it is not incorrect--all the elements smaller than the kth element are moved before this element. So my suggestion is to tweak the docstring to make clear that in the result, not all the elements before the kth are less than the kth element. Some might equal the kth element.

@arcuru
Copy link
arcuru commented Aug 31, 2016

I think you're right about that.

Do you want to submit a PR for the issue? I believe the docstring is in numpy/core/fromnumeric.py.

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 a pull request may close this issue.

2 participants
0