[Numpy-discussion] Why does fancy indexing work like this?

2020-07-22 Thread Aaron Meurer
Why does fancy indexing have this behavior? >>> a = np.empty((0, 1, 2)) >>> b = np.empty((1, 1, 2)) >>> a[np.array([10, 10])] Traceback (most recent call last): File "", line 1, in IndexError: index 10 is out of bounds for axis 0 with size 0 >>> a[:, np.array([10, 10])] array([], shape=(0, 2, 2

Re: [Numpy-discussion] Why does fancy indexing work like this?

2020-07-22 Thread Sebastian Berg
On Wed, 2020-07-22 at 16:23 -0600, Aaron Meurer wrote: > Why does fancy indexing have this behavior? > > > > > a = np.empty((0, 1, 2)) > > > > b = np.empty((1, 1, 2)) > > > > a[np.array([10, 10])] > Traceback (most recent call last): > File "", line 1, in > IndexError: index 10 is out of bounds

Re: [Numpy-discussion] Why does fancy indexing work like this?

2020-07-22 Thread Aaron Meurer
Ah, so I guess I caught this issue right as it got fixed. There are no warnings in 1.19.0, but I can confirm I get the warnings in numpy master. 1.19.1 isn't on conda yet, but I tried building it and didn't get the warning there. So I guess I need to wait for 0.19.2. How long do deprecation cycles

Re: [Numpy-discussion] Why does fancy indexing work like this?

2020-07-22 Thread Aaron Meurer
On Wed, Jul 22, 2020 at 4:55 PM Aaron Meurer wrote: > > Ah, so I guess I caught this issue right as it got fixed. There are no > warnings in 1.19.0, but I can confirm I get the warnings in numpy > master. 1.19.1 isn't on conda yet, but I tried building it and didn't > get the warning there. So I g

Re: [Numpy-discussion] Why does fancy indexing work like this?

2020-07-22 Thread Sebastian Berg
On Wed, 2020-07-22 at 16:55 -0600, Aaron Meurer wrote: > Ah, so I guess I caught this issue right as it got fixed. There are > no Yes, on a general note. Advanced indexing grew over time in a maze of paths, and things like empty arrays were long not too well supported in many parts of NumPy. That

Re: [Numpy-discussion] Why does fancy indexing work like this?

2020-07-22 Thread Aaron Meurer
> About your warnings, do you have a nice way to do that? The mechanism > for warnings does not really give a good way to catch that a warning > was raised and then turn it into an error. Unless someone contributes > a slick way to do it, I am not sure the complexity pays off. I don't really kno