[Numpy-discussion] Question about repeated values in X in A[X] = Y

Thouis (Ray) Jones thouis at gmail.com
Thu Mar 24 17:40:45 EDT 2011


I have done some work on scipy.ndimage.measurements, and was adding to
it recently when I noticed I had made use of the idiom
  A[X] = Y
with repeated indices in X, relying on the behavior that the last X,Y
pair at each unique X is the one that is assigned in A (last = last by
position in X).

I thought I had found documentation of this behavior, somewhere, but
when another developer asked, I was unable to locate it (perhaps I
just forgot the google keywords I used last time).

So, before I rely too much on this behavior, I thought I should make
sure it was:
- correct,
- reasonable future-proof,
- and documented (if the first two are true).

Thanks,
Thouis Jones



More information about the NumPy-Discussion mailing list