-
-
Notifications
You must be signed in to change notification settings - Fork 11k
BUG: Non-bool result when comparing ma scalars. #4335
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
Removed logic replacing masked scalar results from ufuncs with ma.masked singleton which has dtype float64. Fixes numpy#4332.
else: | ||
result._mask = m | ||
result._sharedmask = False | ||
result._mask = m |
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'm a bit at sea here. Will this still return scalars in this case, just with the correct type?
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.
Returning a scalar is very much intended in most of numpy, so I think it is intended here, too, and I would prefer not to change it without good reason. Can't we give masked
a type?
The idea is to return the |
Oops, I missed the fact that is used as a singleton... Sounds like this is complicated and likely not much can be done. |
@seberg - the traditional use for masked singleton is to check for masked items:
This use case is unaffected by my change. I find it really hard to justify the following behaviors:
I will run matplotlib tests with the change. I seriously doubt that anyone is using |
Here is another wart:
|
Sorry, I really don't know this well. As far as I can see, this adds one wart to fix another and since I don't really use masked arrays, I certainly don't know if that may be worth it. |
@pierregm Can you comment as to what you think we should do with this? |
I'm going to close this. A proper solution would probably be to have masked scalars of all types. That option could use some study, especially preserving backward compatibility. |
Or possibly we could fudge things, adding a |
Removed logic replacing masked scalar results from ufuncs
with ma.masked singleton which has dtype float64.
Fixes #4332.