[Numpy-discussion] asanyarray vs. asarray

Hameer Abbasi einstein.edison at gmail.com
Fri Oct 19 04:37:41 EDT 2018


Hi all

> On Friday, Oct 19, 2018 at 10:28 AM, Matti Picus <matti.picus at gmail.com (mailto:matti.picus at gmail.com)> wrote:
>
> Was there discussion around which of `asarray` or asanyarray` to prefer? PR 11162, https://github.com/numpy/numpy/pull/11162, proposes `asanyarray` in place of `asarray` at the entrance to `_quantile_ureduce_func` to preserve ndarray subclasses. Should we be looking into changing all the `asarray` calls into `asanyarray`?
>
>
>

I suspect that this will cause a large number of problems around np.matrix, so unless we deprecate that, this might cause a large amount of problems. The problem with np.matrix is that it’s a subclass, but it’s not substitutable for the base class, and so violates SOLID.

There are efforts to remove np.matrix, with the largest consumer being scipy.sparse, so unless that’s revamped, deprecating np.matrix is kind of hard to do.
>
>
>
>
>
> Matti
>
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at python.org
> https://mail.python.org/mailman/listinfo/numpy-discussion

Best Regards,
Hameer Abbasi

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20181019/8bf33452/attachment.html>


More information about the NumPy-Discussion mailing list