[Numpy-discussion] matrix indexing question

Alan G Isaac aisaac at american.edu
Mon Mar 26 11:53:33 EDT 2007


On Mon, 26 Mar 2007, Sebastian Haase apparently wrote: 
> A "matrix" is an object that you expect a certain 
> (mathematical !) behavior from.  If some object behaves 
> intuitively right -- that's ultimately pythonic!

The problem is, as I am not the only one to point out,
this particular behavior is NOT intuitively right.


> The clash is, NOT to see a matrix  "just as another 
> container".

But be serious, no object is "just another container".
Again, this just begs the question.
The question is a design question.
E.g., what is the principle of least surprise?


> more notes/points: 
> a) I have never heard about the m.A1 - what is it ?

It returns a 1d array holding the raveled matrix.

> b) I don't think that if m[1] would return a (rank 2) 
> matrix, that m[1].A could return a (rank 1) array ...

It does not, of course.
(But both should, I believe.)

> c) I'm curious if there is a unique way to extend the 
> matrix class into 3D or ND. 

Is that not what an array is for??

Cheers,
Alan Isaac





More information about the NumPy-Discussion mailing list