On Thu, Jun 4, 2015 at 6:22 PM, Benjamin Root <ben.r...@ou.edu> wrote:
>
> On Thu, Jun 4, 2015 at 9:04 PM, Nathaniel Smith <n...@pobox.com> wrote:
>>
>> On Thu, Jun 4, 2015 at 5:57 PM, Nathaniel Smith <n...@pobox.com> wrote:
>>
>> One place where the current behavior is particularly baffling and annoying 
>> is when you have multiple boolean masks in the same indexing operation. I 
>> think everyone would expect this to index separately on each axis ("outer 
>> product indexing" style, like slices do), and that's really the only useful 
>> interpretation, but that's not what it does...:
>>
>
> As a huge user of boolean indexes, I have never expected this to work in any 
> way, shape or form. I don't think it works in matlab (but someone should 
> probably check that), so you wouldn't have to worry about converts missing a 
> feature from there. I have always been told that boolean indexing will 
> produce a flattened array, and I wouldn't want to be dealing with magic when 
> the array does not match up right.

Note that there are two types of boolean indexing:

type 1: arr[mask] where mask is n-d (ideally the same shape as "arr",
but I think that it *is* broadcast if not). This always produces 1-d
output.

type 2: arr[..., mask, ...], where mask is 1-d and only applies to the
given dimension.

My comment was about the second type. Are your comments about the
second type? The second type definitely does not produce a flattened
array:

In [7]: a = np.arange(9).reshape(3, 3)

In [8]: a[np.asarray([True, False, True]), :]
Out[8]:
array([[0, 1, 2],
       [6, 7, 8]])

-n

-- 
Nathaniel J. Smith -- http://vorpus.org
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to