Hey Bartosz, On 11/28/12 3:26 PM, Bartosz wrote: > Thanks for answer, Francesc. > > I understand now that fancy indexing returns a copy of a recarray. Is > it also true for standard ndarrays? If so, I do not understand why > X['a'][cond]=-1 should work.
Yes, that's a good question. No, in this case the boolean array `cond` is passed to the __setitem__() of the original view, so this is why this works. The first idiom is concatenating the fancy indexing with another indexing operation, and NumPy needs to create a temporary for executing this, so the second indexing operation acts over a copy, not a view. And yes, fancy indexing returning a copy is standard for all ndarrays. Hope it is clearer now (although admittedly it is a bit strange at first sight), -- Francesc Alted _______________________________________________ NumPy-Discussion mailing list [email protected] http://mail.scipy.org/mailman/listinfo/numpy-discussion
