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

Fix depwarn message for findnext, findprev #24139

Merged
merged 1 commit into from
Oct 15, 2017
Merged

Fix depwarn message for findnext, findprev #24139

merged 1 commit into from
Oct 15, 2017

Conversation

GregPlowman
Copy link
Contributor

Fix depwarn message for findnext and findprev.
See #23812 (comment)

@@ -1610,7 +1610,7 @@ function findnext(A, start::Integer)
while i <= l
a = A[i]
if !warned && !(a isa Bool)
depwarn("In the future `findnext` will only work on boolean collections. Use `findnext(x->x!=0, A)` instead.", :findnext)
depwarn("In the future `findnext` will only work on boolean collections. Use `findnext(x->x!=0, A, start)` instead.", :findnext)
Copy link
Member

Choose a reason for hiding this comment

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

This should probably be recommending findnext(!iszero, A, start). Any particular reason why that wasn't done initially, @JeffBezanson? (You did this initial deprecation, right?)

Copy link
Member

Choose a reason for hiding this comment

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

That was in #23812. I think the reason is that iszero throws an error for some types (see #23005), so the only replacement which is guaranteed to work is x != 0. But in most cases iszero is OK (it's the recommended deprecation for Number).

Copy link
Member

Choose a reason for hiding this comment

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

Okay, thanks

Copy link
Member

@nalimilan nalimilan left a comment

Choose a reason for hiding this comment

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

Thanks!

@ararslan ararslan merged commit b76c0fa into JuliaLang:master Oct 15, 2017
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.

3 participants