[Numpy-discussion] Why ndarray provides four ways to flatten?

Alan G Isaac alan.isaac at gmail.com
Tue Oct 28 13:40:18 EDT 2014


On 10/28/2014 1:25 PM, Nathaniel Smith wrote:
> I too would be curious to know why .flat exists (beyond "it seemed like a good idea at the time"


How else would you iterate over all items of a multidimensional array?
As an example application, use it to assign to an arbitrary diagonal.
(It can be sliced.)

I don't recall the specifics at the moment, but I've been happy to
have it in the past.

Alan Isaac



More information about the NumPy-Discussion mailing list