-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
DOC: Update indexing implementation explanations. #4331
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
Conversation
On the up side, the code is now better documented I think, so I hope that it is actually readable on its own and includes more details. |
* integer arrays/array-likes (fancy) | ||
* boolean (single boolean array); if there is more then one boolean array as | ||
index or the shape does not match exactly, the boolean array will be | ||
converted to integer arrays instead. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds dangerous/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is ;), I would be +1 on deprecating it. May not be quite straight forward, but shouldn't be too hard either. Or do you mean because I forgot to mention the nonzero logic?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd be +1 too. As is, one may never be sure if a boolean is a boolean, or an integer posing as a boolean.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if I was confusing now or not :). It always acts as a boolean, but the path to get there is through np.nonzero
logic. The bad thing about it, is that a boolean array which is too small, will just be filled up with False
.
I think the documentation would be helped enormously by a lot of examples with an explanation of how they are interpreted. |
@seberg - I noticed this PR as the adding of the label made it float to the top. I think it is very useful, but note that in the |
Yeah, should get back to this some time... though I don't understand what this has to do with numpy ufunc... |
I just read the whole section and noticed that https://github.com/numpy/numpy/pull/4331/files#diff-c4ce797b66d44da00848ce950e286105R350 did not mention |
* slice | ||
* ellipsis | ||
* integer arrays/array-likes (fancy) | ||
* boolean (single boolean array); if there is more then one boolean array as |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: "then" -> "than"
@seberg Do you have any time to work on this for 1.10? |
Not really, but it is probably important enough anyway ;). |
I am aware that the old stuff is a bit more in depth. But it is now hopelessly outdated, so I tried to give at least an overview of how things work now. I don't know if this actually gives an idea of what is going on, I wouldn't notice ;)...