Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Implement NA.__array_ufunc__ #30245
Implement NA.__array_ufunc__ #30245
Changes from 28 commits
bf8680f
0c69bd0
46f2327
075d58a
b72dd1c
0371cf4
878ef70
97af2e9
f175a34
f2ac945
0f4e121
fe04554
cf9ac10
72e2b67
8d90e9d
6a2fc68
db4cc40
7b1585a
b79e07f
567c584
b27470d
c7c9184
a0dbca8
ce209f9
e4ecadb
8d2763d
f68e178
d8c23e9
4c30bb4
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
This seems a bit strange, but I suppose it is to follow numpy behaviour of 0-dim arrays returning scalars from comparison operations? (if so, maybe add a comment about that)
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's to NumPy scalars. Without this, we'd have
raise with
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.
A numpy scalar (which is different from a 0-dim array) is not a ndarray, so wouldn't pass the
isinstance(other, np.ndarray)
test. So I don't fully understand how that example is related.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.
could call lib.item_from_zerodim at the top?
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.
@TomAugspurger can you check this thread? I still don't understand how this relates to scalars, as they shouldn't pass the
isinstance(other, np.ndarray)
check. So not sure the below comment is correct.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.
With this
I have
So when we get there, it really does seem like
np.int64(1)
is an ndarray. Is cython doing something?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.
Possibly, no idea. But I trust you this is indeed needed to get it working
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.
for functions that arent
cdef
orcpdef
, we can use python syntax for annotations