Skip to content

array_multiply != the multiply ufunc #3503

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

Closed
inducer opened this issue Jul 5, 2013 · 2 comments
Closed

array_multiply != the multiply ufunc #3503

inducer opened this issue Jul 5, 2013 · 2 comments
Labels
15 - Discussion component: numpy._core Project Possible project, may require specific skills and long commitment

Comments

@inducer
Copy link
Contributor

inducer commented Jul 5, 2013

This issue is a continuation of the disussion with @seberg in #3501, along with #3502:

Lots of places (such as 1, 2) use PyArray_Type->tp_as_number->nb_multiply to call the multiply ufunc (etc.). Because of __array_priority__, the semantics of nb_multiply are no longer the same as the ufunc. Specifically, nb_multiply is required to to return NotImplemented in cases of priority inversion, whereas the ufunc has a job to do and just needs to do it, without asking questions about priorities.


EDIT (seberg): This is still the case and probably cause of a few bugs (I am very sure reading an issue recently). It shouldn't be hard to fix, we have the nb_ops or mapping that is used for the array object: That needs to used throughout for scalartypes.c.src and scalarmath.c.src would do so indirectly then, although directly might solve additional unnecessary dances.

@inducer
Copy link
Contributor Author

inducer commented Jul 5, 2013

See here for a comment explaining how I got bitten by this.

@seberg seberg added the Project Possible project, may require specific skills and long commitment label Jan 28, 2024
@seberg
Copy link
Member

seberg commented Nov 29, 2024

I actually think there are no remaining oddities left here. (At least nb_multiply and nb_add are not used explicitly anymore).

@seberg seberg closed this as completed Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
15 - Discussion component: numpy._core Project Possible project, may require specific skills and long commitment
Projects
None yet
Development

No branches or pull requests

3 participants