On Fri, 2013-07-12 at 19:29 -0400, [email protected] wrote: > On Fri, Jul 12, 2013 at 3:35 PM, Frédéric Bastien <[email protected]> wrote: > > I also don't like that idea, but I'm not able to come to a good reasoning > > like Benjamin. > > > > I don't see advantage to this change and the reason isn't good enough to > > justify breaking the interface I think. > > > > But I don't think we rely on this, so if the change goes in, it probably > > won't break stuff or they will be easily seen and repared. > > > > Fred
<snip> > > I thought Benjamin sounds pretty convincing, and since I never use > this, I don't care. > > However, I (and I'm pretty convinced all statsmodels code) uses > equality comparison only element wise. Getting a boolean back is an > indicator for a bug, which is most of the time easy to trace back. > > There is an inconsistency in the behavior with the inequalities. > Well, I guess I tend to think on the purity side of things. And the comparisons currently mix container and element-wise comparison up. It seems to me that it can lead to bugs, though I suppose it is unlikely to really hit anyone. One thing that keeping the behaviour means, is that the object array comparisons will be a little buggy (you get False for the whole array, when an element comparison gives an error). Though I admit, that for example arrays inside containers make any equality for the container quirky, since arrays cannot define a truth value. But if there is concern that this really could break code I won't try to press for it. - Sebastian > >>> np.array([1,2,3]) < np.array([1,2]) > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > ValueError: shape mismatch: objects cannot be broadcast to a single shape > > >>> np.array([1,2,3]) <= np.array([1,2]) > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > ValueError: shape mismatch: objects cannot be broadcast to a single shape > > >>> (np.array([1,2,3]) == np.array([1,2])).any() > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > AttributeError: 'bool' object has no attribute 'any' > > > The last one could be misleading and difficult to catch. > > >>> np.any(np.array([1,2,3]) == np.array([1,2])) > False > > numpy 1.5.1 since I'm playing rear guard > > Josef > > > Josef > _______________________________________________ > NumPy-Discussion mailing list > [email protected] > http://mail.scipy.org/mailman/listinfo/numpy-discussion > _______________________________________________ NumPy-Discussion mailing list [email protected] http://mail.scipy.org/mailman/listinfo/numpy-discussion
