***[Possible UCE]*** Re: [Numpy-discussion] Can you enumerate an array?

Travis Oliphant oliphant at ee.byu.edu
Wed Oct 12 12:10:44 EDT 2005

Chris Barker wrote:

> Arnd,
> You've written some nice compact code, but it only works for rank-2 
> arrays. Did you see Travis' solution? I think he's put it (or a C 
> version, I'm not sure about that) in scipy_base. However, not using 
> flat is nice, as in Numeric and numarray is sometimes makes a copy, 
> and sometimes doesn't.

Yes, for Numeric and numarray a.flat does that.

But, for scipy core, a.flat never makes a copy.  It just returns an 
iterator object (that can be indexed and has an .__array__() method).  
So using a.flat is not a problem.

Right now the solution I have is in Python.


More information about the NumPy-Discussion mailing list