Something that we just ran into trying to merge a scipy PR: With 1.5.1: >>> np.arange(10)[np.array([0,1,0,1,2,3]) > 0] array([1, 3, 4, 5])
With current master: In [1]: np.arange(10)[np.array([0,1,0,1,2,3]) > 0] --------------------------------------------------------------------------- ValueError Traceback (most recent call last) /Users/rgommers/<ipython-input-1-49ea14823e3d> in <module>() ----> 1 np.arange(10)[np.array([0,1,0,1,2,3]) > 0] ValueError: operands could not be broadcast together with shapes (10) (6) The reason for this is noted in the 2.0.0 release notes: "Full-array boolean indexing used to allow boolean arrays with a size non-broadcastable to the array size. Now it forces this to be broadcastable. Since this affects some legacy code, this change will require discussion during alpha or early beta testing, and a decision to either keep the stricter behavior, or add in a hack to allow the previous behavior to work. " I'm not opposed to the change in principle, but just wanted to note it can lead to code breaking and puzzled users. Ralf
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion