[Numpy-discussion] matrix indexing question

Alan G Isaac aisaac at american.edu
Mon Mar 26 12:57:15 EDT 2007


On Mon, 26 Mar 2007, "Colin J. Williams" apparently wrote: 
> One would expect the iteration over A to return row 
> vectors, represented by (1, n) matrices. 

This is again simple assertion.
**Why** would "one" expect this?
Some people clearly do not.

One person commented that this unexpected behavior was 
a source of error in their code.

Another person commented that they did not even guess that 
such a thing would be possible.

Experience with Python should lead to the ability to 
anticipate the outcome.  Apparently this is not the case.
That suggests a design problem.

What about **Python** would lead us to expect this behavior??

In *contrast*, everyone agrees that for a matrix M,
we should get a matrix from M[0,:].
This is expected and desirable.

Cheers,
Alan Isaac








More information about the NumPy-Discussion mailing list