[Numpy-discussion] Putmask/take ?

Travis Oliphant oliphant at ee.byu.edu
Fri Sep 22 15:29:08 EDT 2006


Travis Oliphant wrote:

>Yes, this does explain what you are seeing.    It is the behavior of 
>Numeric's putmask (where this method came from).   It does seem 
>counter-intuitive, and I'm not sure what to do with it.  In some sense 
>putmask should behave the same as x[m] = w.   But, on the other-hand, 
>was anybody actually using the "modular" indexing "feature" of "putmask".
>
>Here are our options:
>
>1) "fix-it" and risk breaking code for people who used putmask and the 
>modular indexing "feature," 
>2) Get rid of it as a method (and keep it as a function so that 
>oldnumeric can use it.)
>3) Keep everything the way it is.
>  
>

O.K.  putmask is keeping the same behavior (it is intentional behavior 
and has been for a long time).  However, because of the confusion, it is 
being removed as a method (I know this is late, but it's a little-used 
method and was only added by NumPy).    Putmask will be a function.

Also, the remaining put method will have it's arguments switched to 
match the function.  IIRC the original switch was made to accomodate 
masked arrays methods of the same name.  But, this does not really help 
anyway since arr.put for a masked array doesn't even take an indicies 
argument, so confusing users who don't even use masked arrays seems 
pointless.

Scream now if you think I'm being unreasonable.  This will be in 1.0rc2  
(yes we will need rc2)

The original poster has still not explained why

a[mask] = values

does not work suitably.


-Travis





More information about the NumPy-Discussion mailing list