[Numpy-discussion] Experimental `like=` attribute for array creation functions

Ralf Gommers ralf.gommers at gmail.com
Mon Aug 10 18:16:34 EDT 2020


On Mon, Aug 10, 2020 at 8:37 PM Sebastian Berg <sebastian at sipsolutions.net>
wrote:

> On Mon, 2020-08-10 at 17:35 +0200, Hameer Abbasi wrote:
> > Hi,
> >
> > We should have a higher-bandwidth meeting/communication for all
> > stakeholders, and particularly some library authors, to see what
> > would be good for them.
>

I'm not sure that helps. At this point there's little progress since the
last meeting, I think the plan is unchanged: we need implementations of all
the options on offer, and then try them out in PRs for scikit-learn, SciPy
and perhaps another package who's maintainers are interested, to test
like=, __array_module__ in realistic situations.


>
> > We should definitely have language in the NEP that says it won’t be
> > in a release unless the NEP is accepted.
>
> In that case, I think the important part is to have language right now
> in the implementation, although that can refer to the NEP itself of
> course.
> You can't expect everyone who may be tempted to use it to actually read
> the NEP draft, at least not without pointing it out.
>

Agreed, I think the decision is on this list not in the NEP, and to make
sure we won't forget we need an issue opened with the 1.20 milestone.

Cheers,
Ralf


> I will say that I think it is not very high risk, because I think
> annoying or not, the argument could be deprecated again with a
> transition short phase. Admittedly, that argument only works if we have
> a replacement solution.
>
> Cheers,
>
> Sebastian
>
>
> >
> > Best regards,
> > Hameer Abbasi
> >
> > --
> > Sent from Canary (https://canarymail.io)
> >
> > > On Monday, Aug 10, 2020 at 5:31 PM, Sebastian Berg <
> > > sebastian at sipsolutions.net (mailto:sebastian at sipsolutions.net)>
> > > wrote:
> > > Hi all,
> > >
> > > as a heads up that Peter Entschev has a PR open to add `like=` to
> > > most array creation functions, my current plan is to merge it soon
> > > as a preliminary API and bring it up again before the actual
> > > release (in a few months). This allows overriding for array-likes,
> > > e.g. it will allow:
> > >
> > >
> > > arr = np.asarray([3], like=dask_array)
> > > type(arr) is dask.array.Array
> > >
> > > This was proposed in NEP 35:
> > >
> > >
> https://numpy.org/neps/nep-0035-array-creation-dispatch-with-array-function.html
> > >
> > > Although that has not been accepted as of now, the PR is:
> > >
> > > https://github.com/numpy/numpy/pull/16935
> > >
> > >
> > > This was discussed in a smaller group, and is an attempt to see how
> > > we
> > > can make the array-function protocol viable to allow packages such
> > > as
> > > sklearn to work with non-NumPy arrays.
> > >
> > > As of now, this would be experimental and can revisit it before the
> > > actual NumPy release. We should probably discuss accepting NEP 35
> > > more. At this time, I hope that we can put in the functionality to
> > > facilitate this discussion, rather the other way around.
> > >
> > > If anyone feels nervous about this step, I would be happy to
> > > document
> > > that we will not include it in the next release unless the NEP is
> > > accepted first, or at least hide it behind an environment variable.
> > >
> > > Cheers,
> > >
> > > Sebastian
> > >
> > > _______________________________________________
> > > NumPy-Discussion mailing list
> > > NumPy-Discussion at python.org
> > > https://mail.python.org/mailman/listinfo/numpy-discussion
> >
> > _______________________________________________
> > NumPy-Discussion mailing list
> > NumPy-Discussion at python.org
> > https://mail.python.org/mailman/listinfo/numpy-discussion
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at python.org
> https://mail.python.org/mailman/listinfo/numpy-discussion
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20200810/aced35f2/attachment.html>


More information about the NumPy-Discussion mailing list