-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
issubdtype(double, bool) #5711
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
This isn't an answer, but: >>> np.issubdtype(np.double, np.bool_)
False also related >>> np.issubclass_(np.bool, np.generic)
False
>>> np.issubclass_(np.bool_, np.generic)
True
>>> inspect.getmro(np.bool)
(<type 'bool'>, <type 'int'>, <type 'object'>)
>>> inspect.getmro(np.bool_)
(<type 'numpy.bool_'>, <type 'numpy.generic'>, <type 'object'>) |
Thanks for the clarification! Feel free to close the issue, if you think this is the intended behavior. |
|
Yes, it is. For some reason the picture is hidden on this page: I don't know what's going on with the original report, though: dtype(bool)
|
There is this
Python bool was new in python version 2.2.1. It may be that the current behavior is an accident. |
Note that the code in
For example
The commit message in 325aad6 is not very helpful on why this was made so. |
I think #3218 is relevant to this issue. |
This is due to odd behavior in NumPy where floating point numbers are considered subtypes of bool. Now explicitly check if number is floating point. See numpy/numpy#5711
Maybe I am missing something, but is this correct?
np.issubdtype(np.double, np.bool) => True
At the very least, this is confusing.
The text was updated successfully, but these errors were encountered: