If the arrays are the same size or can be broadcasted to the same  
size, it returns true or false on an elementwise basis.
If the arrays are not the same size and can't be broadcasted to the  
same size, it returns False, which was a surprise to me too.

 >>> import numpy as N
 >>> N.asarray([[0,1],[2,3]]) == N.asarray([[1,1],[3,3]])
array([[False,  True],
        [False,  True]], dtype=bool)
 >>> N.asarray([[0,1],[2,3]]) == N.asarray([[1,1]])
array([[False,  True],
        [False, False]], dtype=bool)
 >>> N.asarray([[0,1],[2,3]]) == N.asarray([[1,1],[3,3],[5,5]])
False


On Oct 11, 2010, at 8:58 PM, Vincent Davis wrote:

> Not sure about "be broadcasted to the same shape"
> I would kind of expect == to return true, false or some error.

_______________________________________________
NumPy-Discussion mailing list
[email protected]
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to