[Numpy-discussion] untenable matrix behavior in SVN

Alan G Isaac aisaac at american.edu
Sat Apr 26 14:01:45 EDT 2008


On Sat, 26 Apr 2008, Gael Varoquaux apparently wrote:
> For me this is wrong. list and tuples are not 2D. Numpy 
> arrays happen to offer this feature, but you should not 
> use it do to multiple dimension indexing. 

But there is no proposal that people should index like this.
The underlying issue is iteration.  Currently::

    >>> A
    matrix([[1,  2],
            [ 3,  4]])
    >>> A = np.mat(x)
    >>> for row in A:
    ...  for col in row:
    ...   print col
    ...
    [[1  2]]
    [[3 4]]

So are you saying that one should not be able to iterate 
through to the elements of a matrix?

So many natural expectations are broken by the current behavior!

Cheers,
Alan






More information about the NumPy-Discussion mailing list