[Numpy-discussion] Index array confusion...

Perry Greenfield perry at stsci.edu
Mon Dec 16 11:13:06 EST 2002


Magnus Lie Hetland wrote:

> >Well, what I was asking about was really what you meant by "correct".
> >My interpretation of "correct" here was that only tuples and slices
> >would be allowed as indexes.
> >
To clarify, tuples should be interpreted differently than lists or 
arrays as arguments, as you suggested earlier so that
x[1,2,3] is not interpreted the same as x[[1,2,3]] or x[array([1,2,3])].
Granted, that will be confusing for those that try x[(1,2,3)]
expecting it to be equivalent ot x[[1,2,3]] but we decided that
the benefits of array indices well outweigh that confusing case.

As far as far as slices resulting in views rather than copies
(was with lists), this is a topic that has been talked to death.
The original Numeric has view behavior. When we started on numarray
we were intending to make it more consistent with lists, but there
were many that argued that view semantics were more sensible and
we were persuaded that they were right (besides, the backward
compatibility issue was very important as well).

Perry




More information about the NumPy-Discussion mailing list