-
Notifications
You must be signed in to change notification settings - Fork 46
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
RFC: require [()]
to be a no-op for all ranks?
#833
Comments
The reason is the later bullet point:
Where "should" is "must" for users and no recommendation at all for implementors, IMO. |
Right, but then my question is why does it not read: "Except in the case of providing a single ellipsis or an empty tuple (e.g. ...) ..." Do any of the array libraries have different behaviour for an empty tuple? |
OK, I am not sure I understand the point. I would agree that there is nothing special at all about 0-D. I.e. to me the whole bullet point only serves to clarify the empty tuple case because intuition seems to sometimees lead astray for such cases. I suspect you are right, it something could be clearer, but I am not sure what :). |
This arises from SciPy where (for BC) we still need to get NumPy scalars in array API compatible code, in both the production code and the tests. The only library that seems to complain about Unless I am missing a reasonable alternative interpretation of |
OK, then the question is if one should abandon disallowing partial indices, for the sake of saving you the |
Yeah, perhaps the practical solution is to add a |
FWIW, I was never a fan of the "all axes should be indexed" rule and feel that it leads to unnecessary verbosity for common indexing operations. |
Simply because there may be existing alignment across two or more libraries does not mean that such behavior should be standardized. As stated in the note on multi-axis indexing, The standard allows wiggle room for libraries to implement NumPy-style indexing where trailing dimensions are omitted (i.e., "... should equal N"), but we should not make that required behavior, as current or future libraries could very reasonably opt to treat the omission of a trailing dimension as a user error (e.g., if |
[()]
to be a no-op for all ranks?[()]
to be a no-op for all ranks?
Thanks @kgryte. I feel a lot less strongly about this now, so happy for the issue to be closed. But maybe it should be kept open to discuss Aaron's point above. |
FWIW, I like seeing the One argument for it was so that a library that does (sympy matrices are the only ones I know in Python world):
which I like conceptually; would be able to also do (matlab-style?) But, nobody really does so in Python world right now probably. And arguably, if anything one should probably force users to spell out: |
The standard says:
Why is this restricted to rank
0
? Sure, a reason for the inclusion is probably to be explicit about the divergence from NumPy, but am I missing something about rank0
being special from the standard's perspective? Since[()]
must act like[...]
in the 0D case, should it not always act like that, for consistency?The text was updated successfully, but these errors were encountered: