
Hey Everyone, I felt like I should add to the mix. I added the issue ( https://github.com/numpy/numpy/issues/5679 ) to tie these options together. My main concern is that both wheres behave the same. As far as using a scalar as the first argument, it was an easy example. We could have used actual arrays and we would have had arrays full of Nones. Though I do see this point of "why should we have indices returned for a scalar". This means nonzero should change, as well. I agree with Chuck on case 4. If we already allow all other scalars, None should be no different. Plus, I would rather have a breaking change in the ma module than in core. Best, John
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.
Ben Root On Mar 12, 2015 9:25 PM, "Nathaniel Smith" <njs@pobox.com> wrote:
On Mar 12, 2015 5:02 PM, "Charles R Harris" <charlesr.harris@gmail.com> wrote:
Hi All,
This is apropos gh-5582 dealing with some corner cases of np.where. The
following are the current behavior
> import numpy > numpy.where(True) # case 1 ... (array([0]),) > numpy.where(True, None, None) # case 2 ... array(None, dtype=object) > numpy.ma.where(True) # case 3 ... (array([0]),) > numpy.ma.where(True, None, None) # case 4 ... (array([0]),)
The question is, what exactly should be done in these cases? I'd be
inclined to raise an error for cases 1 and 3. Case two looks correct to me if we agree that scalar inputs are acceptable. Case 4 looks wrong.
I can't think of any reason scalars wouldn't be acceptable. So everything you suggest sounds right to me.
-n Hi All,
This is apropos gh-5582 <https://github.com/numpy/numpy/pull/5582> dealing with some corner cases of np.where. The following are the current behavior
import numpy numpy.where(True) # case 1 ... (array([0]),) numpy.where(True, None, None) # case 2 ... array(None, dtype=object) numpy.ma.where(True) # case 3 ... (array([0]),) numpy.ma.where(True, None, None) # case 4 ... (array([0]),)
The question is, what exactly should be done in these cases? I'd be inclined to raise an error for cases 1 and 3. Case two looks correct to me if we agree that scalar inputs are acceptable. Case 4 looks wrong.
Thoughts?
Chuck
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
participants (1)
-
John Kirkham