[Numpy-discussion] matrix indexing question
Alan Isaac
aisaac@american....
Tue Mar 27 00:05:06 CDT 2007
On Mon, 26 Mar 2007, Travis Oliphant wrote:
> It actually has been offered. You just don't accept it.
> Matrices are containers of matrices.
> If M is an (mxn) matrix then M[0] is a (1xn) matrix.
> Viewing this 1xn matrix as a 1-d array loses it's row-vectorness.
> This seems perfectly logical and acceptable to me. I'm waiting for a
> better explanation as to why this is not acceptable.
> Arguments that rest on what is and what isn't "Pythonic" are not very
> persuasive as this is very often in the eye of the beholder.
Again, I only raised a *question* about whether
there might be a design problem here. My goal
was only to have this explored, and I've tried
to explain why.
The evidence I offer:
- it is surprising (at least to some) that iterating
over a matrix yields matrices
- I believe it is unexpected (prior to instruction) and that
there is a natural more expected behavior
- if that is right, deviation from the expected should have
a good justification
- this behavior has tripped up at least a couple people and
I expect that to happen to many others over time (because
I believe the behavior is unexpected)
- when I desire to iterate over a matrix I always want the
arrays. (Of course there is a way to have them; that's
not the point). I'm interested to see a use case where
the rows are desired as matrices
As you indicate, none of this constitutes an "argument".
And since nobody appears to agree, I should shut up.
This will be my last post on this subject.
Cheers,
Alan Isaac
More information about the Numpy-discussion
mailing list