It's ok to have two different dtypes (in the sense that "d1 is not d2") such that they represent the same kind of data (in the sense that d1 == d2).
However I think your very first test should have returned True (for what it's worth, it returns true with 1.5.1 on Windows 32 bit). -=- Olivier 2011/6/10 Benjamin Root <ben.r...@ou.edu> > Came across an odd error while using numpy master. Note, my system is > 32-bits. > > >>> import numpy as np > >>> type(np.sum([1, 2, 3], dtype=np.int32)) == np.int32 > False > >>> type(np.sum([1, 2, 3], dtype=np.int64)) == np.int64 > True > >>> type(np.sum([1, 2, 3], dtype=np.float32)) == np.float32 > True > >>> type(np.sum([1, 2, 3], dtype=np.float64)) == np.float64 > True > > So, only the summation performed with a np.int32 accumulator results in a > type that doesn't match the expected type. Now, for even more strangeness: > > >>> type(np.sum([1, 2, 3], dtype=np.int32)) > <type 'numpy.int32'> > >>> hex(id(type(np.sum([1, 2, 3], dtype=np.int32)))) > '0x9599a0' > >>> hex(id(np.int32)) > '0x959a80' > > So, the type from the sum() reports itself as a numpy int, but its memory > address is different from the memory address for np.int32. > > Weirdness... > Ben Root > > _______________________________________________ > NumPy-Discussion mailing list > NumPy-Discussion@scipy.org > http://mail.scipy.org/mailman/listinfo/numpy-discussion > >
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion