04.11.2011 23:04, Nathaniel Smith kirjoitti: [clip] > Assuming that, I believe that what people want for IGNORED values is > unop(SPECIAL_1) == SPECIAL_1 > which doesn't seem to be an option in your taxonomy.
Well, you can always add a new branch for rules on what to do with unary ops. [clip] > I'm not sure "assignment" is a useful way to think about what we've > been calling IGNORED values (for MISSING/NA it's fine). I've been > talking about masking/unmasking values or "toggling the IGNORED > state", because my impression is that what people want is something > like: > > a[0] = 3 > a[0] = SPECIAL > # now a[0] == SPECIAL(3) That's partly syntax sugar. What I meant above by assignment is what happens on a[:] = b and what should occur in in-place operations, a += b which are equivalent to a[:] = a + b Yeah, it's a different definition for "destructive" and "non-destructive" than what was used earlier in the discussion. [clip] >> If classified this way, behaviour of items in np.ma arrays is different >> in different operations, but seems roughly PdX, where X stands for >> returning a masked value with the first argument as the payload in >> binary ops if either argument is masked. > > No -- np.ma implements the assignment semantics I described above, not > "d" semantics. Trimming some output for readability: Well, np.ma implements "d" semantics, but because of the way binary ops are noncommutative, in-place binary ops behave as if they were not mutating. Assignments do actually change the masked data: >>> a[:] = b which changes also masked values in `a`. That may be a bug. -- Pauli Virtanen _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion