On Mon, Mar 2, 2009 at 04:19, David Warde-Farley <d...@cs.toronto.edu> wrote: > On 28-Feb-09, at 12:27 PM, Jonathan Taylor wrote: > >> This does seem like the only way to write this nicely. Unfortunately, >> I think this may be wasteful memory wise (in contrast to what the >> obvious matlab code would do) as it constructs an array with the whole >> first index intact at first. > > True enough, though if I understand correctly, this is only a _view_ > onto the original array, and nothing is immediately copied. So it does > waste memory creating a view and then a view on the view, but I don't > think it's proportional to the size of the returned array.
a[[2,3,6], ...][..., [3,2]] You're doing fancy indexing, so there are copies both times. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco _______________________________________________ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion