From 325aad6d001b486b3664ac48f117b32863da66fc Mon Sep 17 00:00:00 2001 From: Travis Oliphant Date: Tue, 15 Aug 2006 00:28:18 +0000 Subject: Fix-up issubdtype to be more useful --- numpy/lib/utils.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'numpy/lib/utils.py') 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 -- cgit v1.2.1