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

Lluís xscript at gmx.net
Fri Nov 4 10:22:49 EDT 2011


Gary Strangman writes:

> For the non-destructive+propagating case, do I understand correctly that 
> this would mean I (as a user) could temporarily decide to IGNORE certain 
> portions of my data, perform a series of computation on that data, and the 
> IGNORED flag (or however it is implemented) would be propagated from 
> computation to computation? If that's the case, I suspect I'd use it all 
> the time ... to effectively perform data subsetting without generating 
> (partial) copies of large datasets. But maybe I misunderstand the 
> intended notion of propagation ...

I *think* you're right. I say "think" because to *me* IGNORE is the opposite of
propagate.

For example, you could temporarily (non-destructively) decide to assign a
propagating special value to array "a". Then do "a+=2; a*=5" and get something
like (which I think is the kind of use case you were talking about):

  # original values
  >>> a
  [1, 1, 1]

  # with special value
  >>> a
  [1, SPECIAL, 1]

  # computations
  >>> a += 2
  >>> a *= 5
  
  # result
  >>> a
  [15, SPECIAL, 15]

  # without special value
  >>> a
  [15, 1, 15]


So yes, separating both properties is not only a matter of elegance and
simplicity, but also has the practical impact of (as Ben said in another mail)
making the non-destructive property into a fancy form of indexing.


Lluis

-- 
 "And it's much the same thing with knowledge, for whenever you learn
 something new, the whole world becomes that much richer."
 -- The Princess of Pure Reason, as told by Norton Juster in The Phantom
 Tollbooth



More information about the NumPy-Discussion mailing list