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

Alan G Isaac aisaac@american....
Sat Apr 26 13:42:04 CDT 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?

Alan Isaac

PS The possibility of adding these attributes is mentioned
on the discussion page:
as are most of the issues that have been coming up again.

More information about the Numpy-discussion mailing list