[Numpy-discussion] Logical indexing and higher-dimensional arrays.
Wed Feb 8 16:27:53 CST 2012
On Feb 8, 2012, at 4:19 PM, Robert Kern wrote:
> On Wed, Feb 8, 2012 at 22:11, Travis Oliphant <email@example.com> wrote:
>> On Feb 8, 2012, at 11:17 AM, firstname.lastname@example.org wrote:
>>> On Wed, Feb 8, 2012 at 10:29 AM, Sturla Molden <email@example.com> wrote:
>>>> On 08.02.2012 15:49, Travis Oliphant wrote:
>>>>> This sort of thing would take time, but is not out of the question in my mind because I suspect the number of users and use-cases of "broadcasted" fancy-indexing is small.
>>> I think I use it quite a bit, and I like that the broadcasting in
>>> indexing is as flexible as the broadcasting of numpy arrays
>>> x[np.arange(len(x)), np.arange(len(x))] gives the diagonal for example.
>>> or picking a different element from each column, (I don't remember
>>> where I used that)
>>> It is surprising at first and takes some getting used to, but I think
>>> it's pretty nice. On the other hand, I always avoid mixing slices and
>>> indexes because of "strange" results.
>> It actually is pretty nice once you understand it. Mixing of fancy indexing and slicing is only nice in special circumstances. I think we would have been better off if rather than move the subspace to the beginning of the array, NumPy raised an error in that case.
>> That would be a useful change.
> We could start with a warning. See how many people kvetch about it. I
> don't like removing long-standing, documented features based on
> suspicions that their user base is small. Our suspicions and
> intuitions about such things aren't worth much.
Yes, Agreed! Starting with a warning would be a good thing.
More information about the NumPy-Discussion