[Numpy-discussion] Response to PEP suggestions

Perry Greenfield perry at stsci.edu
Thu Feb 17 13:18:18 EST 2005

On Feb 17, 2005, at 3:25 PM, Travis Oliphant wrote:

> This is basically new behavior that numarray has started supporting.  
> I just think numarray missed an important case of flattened indexing 
> that MATLAB supports.  My current proposal would distinguish between 
> single-index array cases and tuple-index array cases.
> I'm still thinking about the X.flat possibility.  Basically, I think 
> that direction would requires a new "generic array view" or something 
> like that.  It may be worth trying, but I'm not sure I want to go that 
> direction right now until I convince more people to come on board with 
> Numeric3.
It was new behavior in the sense that Numeric didn't support 
multidimensional array takes and puts at the time. For a long time it 
was the only kind of array indexing IDL supported (1-d and implicit 
.flat of multidimensional arrays). Speaking only for myself, I found 
the .flat semantics more often as unwanted behavior than convenient. 
I'd rather keep the numarray behavior in this case and make the .flat 
case explicit (but I understand the difficulty of that approach). There 
is the possibility of a custom index option (but ugly I suppose)

X[K, flatten]

where flatten is a special object that indexing recognizes as signaling 
a different interpretation to indexing.


More information about the NumPy-Discussion mailing list