From a917c39f44a2c63fb8d5e8bb91f6dc9af2c7f1e2 Mon Sep 17 00:00:00 2001 From: Hameer Abbasi Date: Sat, 24 Aug 2019 16:19:54 +0200 Subject: [PATCH] Implement asarray. --- doc/neps/nep-0031-uarray.rst | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/doc/neps/nep-0031-uarray.rst b/doc/neps/nep-0031-uarray.rst index 0df63b5c3712..e536a8255188 100644 --- a/doc/neps/nep-0031-uarray.rst +++ b/doc/neps/nep-0031-uarray.rst @@ -71,7 +71,7 @@ The way we propose the overrides will be used by end users is:: from numpy import unumpy as np with np.set_backend(backend): - x = np.array(shape, dtype=dtype) + x = np.asarray(my_array, dtype=dtype) And a library that implements a NumPy-like API will use it in the following manner (as an example):: @@ -87,9 +87,10 @@ And a library that implements a NumPy-like API will use it in the following mann return inner - @implements(np.array) - def array(shape, dtype): - # Implementation here + @implements(np.asarray) + def asarray(a, dtype=None, order=None): + # Code here + # Must return NotImplemented for unsupported array types The only change this NEP proposes at its acceptance, is to make ``unumpy`` the officially recommended way to override NumPy. ``unumpy`` will remain a separate repository/package (which we propose to vendor