-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
MAINT/BUG? __array_ufunc__ should try a given type only once #11306
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
Comments
I think for this to make sense, we ought to stop passing the |
@eric-wieser would that mean changing In practice, I would guess that most |
@shoyer: Up to the implementer to decide if they want a
The reason would be to give existing users warning that they'll no longer get to receive every self argument, and prevent new users from ever building logic that uses In principle, we could detect instance methods and emit a warning to keep existing code working. On the other hand, we clearly declared |
I'm not sure how the behavior here is any different here for |
That's interesting, I did not know that. |
I suppose the difference is that for us, passing |
Yes, it's certainly redundant for us, but on the plus side it makes "Experimental" status for NEPs exists so we can change things that are broken without deprecation cycles. It isn't a pass for us to break things just because we've come up with a slightly better design. In any case, I'm going to put this issue here into NEP-18, so at least we'll have a clear place to point to when we change this behavior. |
In the discussion of
__array_function__
, it was noted that__array_ufunc__
is called on every operand (if present) even if an operand of the given type has already been called [1]. This seems rather senseless: if it didn't work the first time, it won't work the second time either; it may be worth checking this (though it doesn't actually cost anything in the common case that the first trial just works -- but it may speed up things a little).[1] https://github.com/numpy/numpy/pull/11303/files#diff-95f51a69624c6765b1ddae13dc0616cbR212
The text was updated successfully, but these errors were encountered: