[Numpy-discussion] missing use case

Alan G Isaac aisaac@american....
Tue Mar 27 12:57:57 CDT 2007

Hi Zachary, 

I think your response highlights very well 
the apparent design flaw. 

Here is your response to my request for a use case where 
iteration over a matrix should yield matrices: 
do not iterate! 

Does some part of you not find that just a little bizarre?! 

As for offering as a use case that with a matrix M 
you are allowed to use M[0] instead of M[0,:] 
when you want the first row as a matrix, 
I really cannot take that trivial convenience seriously 
as the basis of a fundamental design decision. 

However there is no sympathy for my view on this, 
so I am not debating it any more.  Instead I have asked 
a simple question: what use case is this design decision 
supporting?  I am interested in this so that I can see into 
the decision better. 

Nowith Chris proposes that "M[i] == M[i,:] by definition".
If so, that is an design-based answer to my question.
I agree that M[i,:] should return a matrix.
But my understanding was different:
I thought M[i] relied on standard Python idexing
while M[i,:] was numpy indexing.

Alan Isaac

More information about the Numpy-discussion mailing list