-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
issubdtype fails with string representations #3218
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
The problem doesn't seem to be with passing the string representation. It looks to be a problem with the function's logic itself.
https://github.com/numpy/numpy/blob/master/numpy/core/numerictypes.py#L767 I don't understand the point of this |
If anyone wants to address it, gh-2334 is probably related. |
Still in 1.9-devel. Robert's suggestion looks good, so marking this easy fix. |
Although it probably gets complicated ;) |
I was trying to understand the And any suggestions regarding the safety of In the current implementation, as pointed out in the documentation, even a call of
just returns
|
This function is (sans doc-string): def issubdtype(arg1, arg2):
if issubclass_(arg2, generic):
return issubclass(dtype(arg1).type, arg2)
mro = dtype(arg2).type.mro()
if len(mro) > 1:
val = mro[1]
else:
val = mro[0]
return issubclass(dtype(arg1).type, val) This just seems strange, Why isn't it: def issubdtype(arg1, arg2):
if issubclass_(arg2, generic):
return issubclass(dtype(arg1).type, arg2)
return issubclass(dtype(arg1).type, dtype(arg2).type) Instead? This avoids the issue that @cpascual describes. What is the point of the conditional mro-traversing? |
Deprecated in #9505:
|
Uh oh!
There was an error while loading. Please reload this page.
According to the docs, the arguments of issubdtype can be "dtype or string representing a typecode", but it fails in the second case.
The text was updated successfully, but these errors were encountered: