Thu, 21 Oct 2010 12:50:11 -0700, Mark Wiebe wrote: [clip] > >>> import numpy as np > >>> from numpy.core.multiarray import memorysimpleview as memoryview > >>> obj = np.array(([[1, 2], [3, 4]],), dtype=[('a', '<i8', (2, 2))]) > >>> x = memoryview(obj) > >>> y = np.asarray(x) > >>> obj == y > False > > >>> y['a'].shape > (1, 2, 2) > >>> obj['a'].shape > (2, 2) > > This happens because y.shape is (1,) and obj.shape is (), then the > dtype's (2,2) shape is being appended to both when extracting the field > 'a'.
Nice catch! It seems that `_void_compare` *must* handle broadcasting itself -- I thought this was done by the caller, but apparently not. So you're right that the correct place to do the shape check is on the dtype level. -- Pauli Virtanen _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion