[Numpy-discussion] .flat

Pauli Virtanen pav at iki.fi
Tue Jul 23 12:36:08 EDT 2013


23.07.2013 19:22, Charles R Harris kirjoitti:
[clip]
> Grepping in my code, I find a lot of things like
>
> dfx = van.dot((ax2 - ax1).flat)
>
> IIRC, the flat version was faster than other methods.

That goes through the same code path as
`van.dot(np.asarray((ax2 - ax1).flat))`, which calls the `__array__` 
attribute of the flatiter object. If it's faster than .ravel(), that is 
surprising.

-- 
Pauli Virtanen




More information about the NumPy-Discussion mailing list