[Numpy-discussion] Slicing/selection in multiple dimensions simultaneously
Mon Mar 2 14:10:29 CST 2009
On Mon, Mar 2, 2009 at 13:10, David Warde-Farley <email@example.com> wrote:
> On 2-Mar-09, at 12:25 PM, Robert Kern wrote:
>> a[[2,3,6], ...][..., [3,2]]
>> You're doing fancy indexing, so there are copies both times.
> So I guess the only way to avoid the second copy is to do what Jon
> initially suggested, i.e. a[ix_([2,3,6],range(a.shape),[3,2])] ?
> I suppose xrange would be better than arange() or range() as it
> wouldn't create and destroy the list all at once.
I believe an array would be created from it, so arange() would be the
"best" bet there. But really, the difference is so trivial.
"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
More information about the Numpy-discussion