summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHameer Abbasi <hameerabbasi@yahoo.com>2019-08-24 16:19:54 +0200
committerHameer Abbasi <hameerabbasi@yahoo.com>2019-08-24 16:21:23 +0200
commita917c39f44a2c63fb8d5e8bb91f6dc9af2c7f1e2 (patch)
treecb646cd345f8457be20b5e9cc80acec96529bcb7
parent082836bed133f79962d770c92636c6235a0ec5c1 (diff)
downloadnumpy-a917c39f44a2c63fb8d5e8bb91f6dc9af2c7f1e2.tar.gz
Implement asarray.
-rw-r--r--doc/neps/nep-0031-uarray.rst9
1 files changed, 5 insertions, 4 deletions
diff --git a/doc/neps/nep-0031-uarray.rst b/doc/neps/nep-0031-uarray.rst
index 0df63b5c3..e536a8255 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