[Numpy-discussion] dtype subarray comparison

Mark Wiebe mwwiebe@gmail....
Thu Oct 21 15:33:21 CDT 2010

On Thu, Oct 21, 2010 at 1:06 PM, Pauli Virtanen <pav@iki.fi> wrote:

> <snip>
> 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.
There's a bug in my current patch with regard to this then, as follows:

 >>> x = np.array([(0,),(0,),(1,)],dtype=[('a','f8',(1,))])
>>> y = np.array([[(0,)],[(1,)]],dtype=[('a','f8',(1,))])
>>> x==y
array([ True, False, False], dtype=bool)
>>> y==x
array([[ True,  True, False],
       [False, False,  True]], dtype=bool)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20101021/eeecfcda/attachment-0001.html 

More information about the NumPy-Discussion mailing list