[Numpy-discussion] .flat

Pauli Virtanen pav at iki.fi
Tue Jul 23 10:46:20 EDT 2013

23.07.2013 17:34, Benjamin Root kirjoitti:
> Don't assume .flat is not commonly used.  A common idiom in matlab is
> "a[:]" to flatten an array. When porting code over from matlab, it is
> typical to replace that with either "a.flat" or "a.flatten()", depending
> on whether an iterator or an array is needed.

It is much more rarely used than `ravel()` and `flatten()`, as can be 
verified by grepping e.g. the matplotlib source code.

Pauli Virtanen

More information about the NumPy-Discussion mailing list