From edd16e6664c48dbabd5e0446ff8306fc7a0862b5 Mon Sep 17 00:00:00 2001 From: Peter Andreas Entschev Date: Wed, 16 Oct 2019 11:21:10 +0200 Subject: MAINT: fix implementation example of NEP-33 --- doc/neps/nep-0033-array-creation-dispatch-with-array-function.rst | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'doc/neps/nep-0033-array-creation-dispatch-with-array-function.rst') 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: -- cgit v1.2.1