Hi all,

New to the mailing list, so I hope I'm creating a discussion in the right place.

Am I the only one that thinks that Advanced indexing in numpy doesn't follow 
the principle of minimum astonishment?

for example

```python
a = np.random.rand(100, 100)

a[(2,4)] #this yields the element at [2,4]
a[[2,4]] #this yields the rows at position 2 and 4
a[1, (2,4)] #this yields the 2nd and 4th elements of row 1. (So actually does 
advanced indexing)
a[1, [2,4]] # Works the same way as the previous one.
```

Worst of all, it's very easy for someone do a mistake and not notice it: it 
seems to me that the first method, a[(2,4)], should not be allowed, and instead 
only a[*(2,4)] should work. How checked how it works in Julia (which has a 
similar syntax), and a[(2,4)] would yield an error, which makes sense to me. 
Could it be an idea to deprecate a[(2,4)]-like usages?
_______________________________________________
NumPy-Discussion mailing list -- numpy-discussion@python.org
To unsubscribe send an email to numpy-discussion-le...@python.org
https://mail.python.org/mailman3/lists/numpy-discussion.python.org/
Member address: arch...@mail-archive.com

Reply via email to