Accepting NEP 35 `like=array_like` for use with `__array_function__`
![](https://secure.gravatar.com/avatar/b4f6d4f8b501cb05fd054944a166a121.jpg?s=120&d=mm&r=g)
Hi all, I have opened a PR (https://github.com/numpy/numpy/pull/19188) to *finalize* NEP 35: https://numpy.org/neps/nep-0035-array-creation-dispatch-with-array-function.... Which added `like=` keyword argument to `np.array`, `np.asarray`, `np.arange`, etc. as final. The previous acceptance mail was here: https://mail.python.org/pipermail/numpy-discussion/2021-May/081761.html But, since it may have flown under the radar. Please don't hesitate to voice any concerns! We are planning to include this finalization in the NumPy 1.21 release. So if you are worried about it, please make sure to voice that soon since the release process for 1.21 started. I had previously noted some possible concerns here: https://github.com/numpy/numpy/issues/17075 but in the current version, the `like=` argument is strict about types and will raise for `np.array(3, like=3)`. With that limitation, most of those points seem unproblematic. Cheers, Sebastian
![](https://secure.gravatar.com/avatar/5f88830d19f9c83e2ddfd913496c5025.jpg?s=120&d=mm&r=g)
On Mon, Jun 7, 2021 at 8:34 PM Sebastian Berg <sebastian@sipsolutions.net> wrote:
Hi all,
I have opened a PR (https://github.com/numpy/numpy/pull/19188) to *finalize* NEP 35:
https://numpy.org/neps/nep-0035-array-creation-dispatch-with-array-function....
Which added `like=` keyword argument to `np.array`, `np.asarray`, `np.arange`, etc. as final.
The previous acceptance mail was here: https://mail.python.org/pipermail/numpy-discussion/2021-May/081761.html
But, since it may have flown under the radar. Please don't hesitate to voice any concerns! We are planning to include this finalization in the NumPy 1.21 release. So if you are worried about it, please make sure to voice that soon since the release process for 1.21 started.
I had previously noted some possible concerns here: https://github.com/numpy/numpy/issues/17075 but in the current version, the `like=` argument is strict about types and will raise for `np.array(3, like=3)`. With that limitation, most of those points seem unproblematic.
Thanks Sebastian. I agree. And IIRC there haven't been problems with the current implementation in 1.20 reported, so we should be all good here. Cheers, Ralf
participants (2)
-
Ralf Gommers
-
Sebastian Berg