[Numpy-discussion] in the NA discussion, what can we agree on?
Pauli Virtanen
pav@iki...
Fri Nov 4 16:41:51 CDT 2011
04.11.2011 20:49, T J kirjoitti:
[clip]
> To push this forward a bit, can I propose that IGNORE behave as: PnC
The *n* classes can be a bit confusing in Python:
### PnC
>>> x = np.array([1, 2, 3])
>>> y = np.array([4, 5, 6])
>>> ignore(y[1])
>>> z = x + y
>>> z
np.array([5, IGNORE(7), 9])
>>> x += y # NB: x[1] := x[1] + y[1]
>>> x
np.array([5, 2, 3])
***
I think I defined the "destructive" and "non-destructive" in a different
way than earlier in the thread. Maybe this behavior from np.ma is closer
to what was meant earlier:
>>> x = np.ma.array([1, 2, 3], mask=[0, 0, 1])
>>> y = np.ma.array([4, 5, 6], mask=[0, 1, 1])
>>> x += y
>>> x
masked_array(data = [5 -- --],
mask = [False True True],
fill_value = 999999)
>>> x.data
array([5, 2, 3])
Let's call this (since I botched and already reserved the letter "n" :)
(m) mark-ignored
a := SPECIAL_1
# -> a == SPECIAL_a ; the payload of the RHS is neglected,
# the assigned value has the original LHS
# as the payload
--
Pauli Virtanen
More information about the NumPy-Discussion
mailing list