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

Alexander Belopolsky ndarray at mac.com
Tue Oct 28 21:46:50 EDT 2014


On Tue, Oct 28, 2014 at 9:23 PM, Nathaniel Smith <njs at pobox.com> wrote:

> OTOH trying to make .flat into a full duck-compatible ndarray-like
> type is a non-starter; it would take a tremendous amount of work for
> no clear gain.
>

I don't think so - I think all the heavy lifting is already done in
flatiter.  The missing parts are mostly trivial things like .size or .shape
or can be fudged by coercing to true ndarray using existing
flatiter.__array__ method.

It would be more interesting however if we could always return a true
ndarray view.  How is ndarray.diagonal() view implemented in 1.9?  Can
something similar be used to create a flat view?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20141028/ecc4ed97/attachment.html>


More information about the NumPy-Discussion mailing list