Closed
Description
Original ticket http://projects.scipy.org/numpy/ticket/1739 on 2011-02-10 by @pv, assigned to unknown.
Interestingly,
>>> np.issubdtype(int, np.bool_)
False
>>> np.issubdtype(str, bool)
True
The issubdtype routine apparently does not work correctly for this case (and never has). What it does is
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)
Using mro[1] makes e.g. the Python int
type behave as the more general signedinteger
.
For bool
, it's directly generic
, which results into strangeness.
It might be better to hardcode the special handling of Python types, than just picking mro[1]...