# [Numpy-discussion] in the NA discussion, what can we agree on?

T J tjhnson@gmail....
Fri Nov 4 22:33:34 CDT 2011

```On Fri, Nov 4, 2011 at 8:03 PM, Nathaniel Smith <njs@pobox.com> wrote:

> On Fri, Nov 4, 2011 at 7:43 PM, T J <tjhnson@gmail.com> wrote:
> > On Fri, Nov 4, 2011 at 6:31 PM, Pauli Virtanen <pav@iki.fi> wrote:
> >> An acid test for proposed rules: given two arrays `a` and `b`,
> >>
> >>         a = [1, 2, IGNORED(3), IGNORED(4)]
> >>        b = [10, IGNORED(20), 30, IGNORED(40)]
> [...]
> >
> > Yes.  They both equal:
> >
> >    unmask([11, IGNORED(22), IGNORED(33), IGNORED(44)])
> >      =
> >    [11, 22, 33, 44]
>
> Again, I really don't think you're going to be able to sell an API where
>  [2] + [IGNORED(20)] == [IGNORED(22)]
> I mean, it's not me you have to convince, it's Gary, Pierre, maybe
> Benjamin, Lluís, etc. So I could be wrong. But you might want to
> figure that out first before making plans based on this...
>

But this is how np.ma currently does it, except that it doesn't compute the
And it seems that this generalizes the way people want it to:

>>> z = [2, 4] + [IGNORED(20), 3]
>>> z
[IGNORED(24), 7]
>>> z.sum(skip_ignored=True)   # True could be the default
7
>>> z.sum(skip_ignored=False)
IGNORED(31)

I guess I am confused because it seems that you implicitly used this same
rule here:

Say we have
>>> a = np.array([1, IGNORED(2), 3])
>>> b = np.array([10, 20, 30])
(Here's I'm using IGNORED(2) to mean a value that is currently
ignored, but if you unmasked it it would have the value 2.)

Then we have:

# non-propagating **or** propagating, doesn't matter:

>>> a + 2

[3, IGNORED(2), 5]

That is, element-wise, you had to have done:

IGNORED(2) + 2 --> IGNORED(2).

I said it should be equal to IGNORED(4), but the result is still some form
of ignore.  Sorry if I am missing the bigger picture at this point....its
late and a Fri.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20111104/b6244cfd/attachment.html
```