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

MAINT: Switch np.where(c) for np.nonzero(c) #8972

Merged
merged 1 commit into from
Jun 28, 2018

Conversation

eric-wieser
Copy link
Contributor

@eric-wieser eric-wieser commented Jun 26, 2018

Rationale:

  • np.nonzero(c) is (negligibly) faster
  • np.nonzero(c) has better docs, whereas np.where(c) mixes the docs with the unrelated np.where(c, x, y)
  • np.nonzero(c) support duck-types
  • There should be one-- and preferably only one --obvious way to do it.
  • Rearranges these into a form where np.flatnonzero can now obviously be substituted (in a future PR)

Rationale:

* np.nonzero(c) is faster
* np.nonzero(c) has better docs, whereas np.where(c) mixes the docs with the unrelated np.where(c, x, y)
* There should be one-- and preferably only one --obvious way to do it.
* Rearranges these into a form where `np.flatnonzero` can now obviously be substituted (in a future PR)
@rgommers rgommers closed this Jun 28, 2018
@rgommers rgommers reopened this Jun 28, 2018
@eric-wieser
Copy link
Contributor Author

I think this failure's on me - I'll come back to it in a few days

@rgommers rgommers added the maintenance Items related to regular maintenance tasks label Jun 28, 2018
@rgommers rgommers merged commit f2724d8 into scipy:master Jun 28, 2018
@rgommers
Copy link
Member

LGTM, thanks Eric.

Test failures were unrelated.

@rgommers rgommers added this to the 1.2.0 milestone Jun 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Items related to regular maintenance tasks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants