[Numpy-discussion] is __array_ufunc__ ready for prime-time?

Marten van Kerkwijk m.h.vankerkwijk at gmail.com
Thu Nov 2 17:37:21 EDT 2017

On Thu, Nov 2, 2017 at 5:09 PM, Benjamin Root <ben.v.root at gmail.com> wrote:
> Duck typing is great and all for classes that implement some or all of the
> ndarray interface.... but remember what the main reason for asarray() and
> asanyarray(): to automatically promote lists and tuples and other
> "array-likes" to ndarrays. Ignoring the use-case of lists of lists is
> problematic at best.

How I wish numpy had never gone there! Convenience for what, exactly?
For the user not having to put `array()` around the list themselves?
We slow down everything for that? And even now we're trying to remove
some of the cases where both tuples and lists are allowed. Grrrrrr. Of
course, we are well and truly stuck with it - now it is one of the
main reasons to subclass rather than duck-type... Anyway, water under
the bridge...  -- Marten

More information about the NumPy-Discussion mailing list