On Fri, Mar 13, 2015 at 2:09 PM, Charles R Harris <charlesr.har...@gmail.com
> wrote:

>
>
> On Fri, Mar 13, 2015 at 1:26 PM, Nathaniel Smith <n...@pobox.com> wrote:
>
>> On Thu, Mar 12, 2015 at 9:35 PM, Benjamin Root <ben.r...@ou.edu> wrote:
>> > I think the question is if scalars should be acceptable for the first
>> > argument, not if it should be for the 2nd and 3rd argument.
>> >
>> > If scalar can be given for the first argument, the the first three makes
>> > sense. Although, I have no clue why we would allow that.
>>
>> Why wouldn't we? The where function takes three arguments which are
>> broadcast against each other, so disallowing scalars would require
>> adding a special case.
>>
>
> I'm coming to the conclusion that only #4 is incorrect. The process seems
> to go: cast scalars to 1-D arrays (hence #1 and #3), and indexing results
> in #2.
>
> The oddity is that the second and third arguments are optional, and the
> action of the function depends on that. I would have made those arguments
> required as omitting them gives the same as a call to nonzero. But things
> are as they are...
>

To summarize, np.where is OK as is, np.ma.where needs fixing.

As for deprecating the use of np.where as np.nonzero, that looks very easy
to do in the code. However, the PyArray_Where function is in the numpy
C-API so we might want to be careful about doing that.

Chuck
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to