summaryrefslogtreecommitdiff
path: root/numpy/lib/utils.py
diff options
context:
space:
mode:
authorTravis Oliphant <oliphant@enthought.com>2006-08-15 00:28:18 +0000
committerTravis Oliphant <oliphant@enthought.com>2006-08-15 00:28:18 +0000
commit325aad6d001b486b3664ac48f117b32863da66fc (patch)
tree6db2748e65d166bb991c707d66e74304e1721c84 /numpy/lib/utils.py
parent5d9449f721b3a2ab6dceeabd23e9f50348c4282a (diff)
downloadnumpy-325aad6d001b486b3664ac48f117b32863da66fc.tar.gz
Fix-up issubdtype to be more useful
Diffstat (limited to 'numpy/lib/utils.py')
-rw-r--r--numpy/lib/utils.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/numpy/lib/utils.py b/numpy/lib/utils.py
index 400f378a6..db7c00db6 100644
--- a/numpy/lib/utils.py
+++ b/numpy/lib/utils.py
@@ -1,7 +1,7 @@
import sys, os
import inspect
import types
-from numpy.core.numerictypes import obj2sctype, integer
+from numpy.core.numerictypes import obj2sctype, integer, generic
from numpy.core.multiarray import dtype as _dtype, _flagdict, flagsobj
from numpy.core import product, ndarray
@@ -19,7 +19,14 @@ def issubsctype(arg1, arg2):
return issubclass(obj2sctype(arg1), obj2sctype(arg2))
def issubdtype(arg1, arg2):
- return issubclass(_dtype(arg1).type, _dtype(arg2).type)
+ 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)
def get_include():
"""Return the directory in the package that contains the numpy/*.h header