Just a question, should == behave like a ufunc or like python == for tuple?
I think that all ndarray comparision (==, !=, <=, ...) should behave the same. If they don't (like it was said), making them consistent is good. What is the minimal change to have them behave the same? From my understanding, it is your proposal to change == and != to behave like real ufunc. But I'm not sure if the minimal change is the best, for new user, what they will expect more? The ufunc of the python behavior? Anyway, I see the advantage to simplify the interface to something more consistent. Anyway, if we make all comparison behave like ufunc, there is array_equal as said to have the python behavior of ==, is it useful to have equivalent function the other comparison? Do they already exist. thanks Fred On Mon, Jul 15, 2013 at 10:20 AM, Nathaniel Smith <n...@pobox.com> wrote: > On Mon, Jul 15, 2013 at 2:09 PM, bruno Piguet <bruno.pig...@gmail.com> > 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 > 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