On Mon, Jul 15, 2013 at 2:09 PM, bruno Piguet <[email protected]> wrote: > Python itself doesn't raise an exception in such cases : > >>>> (3,4) != (2, 3, 4) > True >>>> (3,4) == (2, 3, 4) > False > > Should numpy behave differently ?
The numpy equivalent to Python's scalar "==" is called array_equal, and that does indeed behave the same: In [5]: np.array_equal([3, 4], [2, 3, 4]) Out[5]: False But in numpy, the name "==" is shorthand for the ufunc np.equal, which raises an error: In [8]: np.equal([3, 4], [2, 3, 4]) ValueError: operands could not be broadcast together with shapes (2) (3) -n _______________________________________________ NumPy-Discussion mailing list [email protected] http://mail.scipy.org/mailman/listinfo/numpy-discussion
