[Numpy-discussion] adding ``rows`` and ``columns`` attributes to matrices

Alan G Isaac aisaac at american.edu
Sat Apr 26 14:42:04 EDT 2008


On Sat, 26 Apr 2008, Gael Varoquaux apparently wrote:
>  for row in A.rows():
>    for col in row.cols()


Actually I am in favor of adding ``rows`` and ``cols`` 
attributes to allow such iteration.  The only thing is,
I say these should be matrices (i.e., 2d).  I.e., this
should provide a symmetric syntax (for rows and columns)
for iteration across submatrices.

But once we have these, it is all the more reason not
to object to letting iteration on the matrix yield
1d arrays.  As others have observed: why break array
behavior for no purpose?

Cheers,
Alan Isaac

PS The possibility of adding these attributes is mentioned
on the discussion page:
<URL:http://www.scipy.org/MatrixIndexing>
as are most of the issues that have been coming up again.




More information about the NumPy-Discussion mailing list