On Nov 13, 2007 2:18 PM, Stefan van der Walt <[EMAIL PROTECTED]> wrote: > Hi Sebastian > > On Tue, Nov 13, 2007 at 01:11:33PM +0100, Sebastian Haase wrote: > > Hi, > > I need to check the array dtype in a way that it is ignoring > > differences coming only from big-endian vs. little-endian. > > Does > > N.issubdtype(first_dtype, second_dtype) > > work?
Hi Stéfan ! It appears to work : >>> N.empty(5, dtype=">f").dtype==N.float32 False >>> N.empty(5, dtype="<f").dtype==N.float32 True >>> a = N.empty(5, dtype=">f") >>> a.dtype >f4 >>> a.dtype.type <type 'numpy.float32'> >>> N.issubdtype(a.dtype, N.float32) True >>> a = N.empty(5, dtype=">?") >>> a.dtype bool >>> a = N.empty(5, dtype="<?") >>> a.dtype bool >>> a = N.empty(5, dtype=">?") >>> N.issubdtype(a.dtype, N.bool) True >>> N.issubdtype(a.dtype, N.bool_) True Furthermore however, >>> N.empty(5, dtype=">?").dtype == N.empty(5, dtype="<?").dtype True So, for "symmetry reasons" with my existing non-bool code, I would likely use "arr.dtype.type == N.bool_". Still wondering what the "_" means here. (reading the book did not enlighten....) Thanks, Sebastian _______________________________________________ Numpy-discussion mailing list [email protected] http://projects.scipy.org/mailman/listinfo/numpy-discussion
