summaryrefslogtreecommitdiff
path: root/doc/neps/nep-0033-array-creation-dispatch-with-array-function.rst
diff options
context:
space:
mode:
authorPeter Andreas Entschev <peter@entschev.com>2019-10-16 11:21:10 +0200
committerPeter Andreas Entschev <peter@entschev.com>2019-10-16 11:58:55 +0200
commitedd16e6664c48dbabd5e0446ff8306fc7a0862b5 (patch)
tree63d416552807a0bdcd0aaa8109fa987c7c7119c3 /doc/neps/nep-0033-array-creation-dispatch-with-array-function.rst
parent13dd42b784f3530753e53260c18f6aa2c957de5a (diff)
downloadnumpy-edd16e6664c48dbabd5e0446ff8306fc7a0862b5.tar.gz
MAINT: fix implementation example of NEP-33
Diffstat (limited to 'doc/neps/nep-0033-array-creation-dispatch-with-array-function.rst')
-rw-r--r--doc/neps/nep-0033-array-creation-dispatch-with-array-function.rst8
1 files changed, 2 insertions, 6 deletions
diff --git a/doc/neps/nep-0033-array-creation-dispatch-with-array-function.rst b/doc/neps/nep-0033-array-creation-dispatch-with-array-function.rst
index 886a34686..639ed6210 100644
--- a/doc/neps/nep-0033-array-creation-dispatch-with-array-function.rst
+++ b/doc/neps/nep-0033-array-creation-dispatch-with-array-function.rst
@@ -86,9 +86,7 @@ with ``overrides.array_function_dispatch``:
.. code:: python
def _asarray_decorator(a, dtype=None, order=None, like=None):
- if like is not None:
- return (like,)
- return (a,)
+ return (like,)
@set_module('numpy')
@array_function_dispatch(_asarray_decorator)
@@ -116,9 +114,7 @@ the module too.
@array_function_nodocs_from_c_func_and_dispatcher(_multiarray_umath.array)
def array(a, dtype=None, copy=True, order='K', subok=False, ndmin=0, like=None):
- if like is not None:
- return (like,)
- return (a,)
+ return (like,)
There are two downsides to the implementation above for C functions: