Came across this today when trying to determine what was wrong with my code:
import numpy as np matched_to = np.array([-1] * 5) in_ellipse = np.array([False, True, True, True, False]) match = np.array([False, True, True]) matched_to[in_ellipse][match] = 3 I would expect matched_to to now be "array([-1, -1, 3, 3, -1])", but instead, it is still all -1. It would seem that unless the view was created by a slice, then the assignment into the indexed view would not work as expected. This works: >>> matched_to[:3][match] = 3 but not: >>> matched_to[np.array([0, 1, 2])][match] = 3 Note that the following does work: >>> matched_to[np.array([0, 1, 2])] = 3 Is this a bug, or was I wrong to expect this to work this way? Thanks, Ben Root
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion