[Numpy-discussion] Index array confusion...

Perry Greenfield perry at stsci.edu
Mon Dec 16 14:25:01 EST 2002

> And performance, perhaps?
Certainly. That was one big factor (more with regard to
memory demands than CPU demands).

> And; from Todd's comment about a hypothetical built-in for the
> purpose, I assume there is no way of copying the contents of one slice
> to another without going via a temporary array?
If you mean:

Without overwriting the slice being copied to with overlapping slices
(whether it's a problem depends on how they overlap and whether one is
reversed or not, and one other effect described below) on the same array,
that's generally true.

In numarray, there are cases where the slice is copied internally in
blocks. It's possible that you could get away with

x[:] = x[-1::-1]

if x is smaller than the blocksize being used. You would be crazy
to depend on this though :-) For large enough arrays (try 10000 elements),
it definitely won't work.


More information about the NumPy-Discussion mailing list