[Numpy-discussion] Bug in np.nonzero / Should index returning functions return ndarray subclasses?

Nathaniel Smith njs at pobox.com
Sat May 9 16:56:24 EDT 2015


On Sat, May 9, 2015 at 1:27 PM, Benjamin Root <ben.root at ou.edu> wrote:
>
> On Sat, May 9, 2015 at 4:03 PM, Nathaniel Smith <njs at pobox.com> wrote:
>>
>> Not sure what this has to do with Jaime's post about nonzero? There is
>> indeed a potential question about what 3-argument where() should do with
>> subclasses, but that's effectively a different operation entirely and to
>> discuss it we'd need to know things like what it historically has done and
>> why that was causing problems.
>
> Because my train of thought started at np.nonzero(), which I have always
> just mentally mapped to np.where(), and then... squirrel!
>
> Indeed, np.where() has no bearing here.

Ah, gotcha :-).

There is an argument that we should try to reduce this confusion by
nudging people to use np.nonzero() consistently instead of np.where(),
via the documentation and/or a warning message...

-- 
Nathaniel J. Smith -- http://vorpus.org



More information about the NumPy-Discussion mailing list