[NumPy-Tickets] [NumPy] #1739: issubdtype(<whatever>, bool) malfunctions

NumPy Trac numpy-tickets@scipy....
Wed Feb 9 18:05:12 CST 2011

#1739: issubdtype(<whatever>, bool) malfunctions
 Reporter:  pv          |       Owner:  somebody
     Type:  defect      |      Status:  new     
 Priority:  low         |   Milestone:  2.0.0   
Component:  numpy.core  |     Version:  1.5.0   
 Keywords:              |  
 >>> np.issubdtype(int, np.bool_)
 >>> np.issubdtype(str, bool)
 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]
         val = mro[0]
     return issubclass(dtype(arg1).type, val)
 Using mro[1] makes e.g. the Python `int` type behave as the more general

 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]...

Ticket URL: <http://projects.scipy.org/numpy/ticket/1739>
NumPy <http://projects.scipy.org/numpy>
My example project

More information about the NumPy-Tickets mailing list