diff options
author | Stephan Hoyer <shoyer@google.com> | 2019-01-22 14:07:47 -0800 |
---|---|---|
committer | Stephan Hoyer <shoyer@google.com> | 2019-01-22 14:13:39 -0800 |
commit | 96d179ce5bd0e3f75508f6afdfb2fb65170cc83c (patch) | |
tree | eda5cca68be758029c47c10252d7a59189935c3f /numpy/core/overrides.py | |
parent | 3cbc11ac56054ad3ac7461e57433aefe37f2e3e4 (diff) | |
download | numpy-96d179ce5bd0e3f75508f6afdfb2fb65170cc83c.tar.gz |
ENH: __array_function__ updates for NumPy 1.17.0
- Always enable __array_function__ overrides.
- Remove special cases for Python 2 compatibility.
- Document these changes in 1.17.0-notes.rst.
It will be good to see ASV numbers to understand the performance implications
of these changes. If need be, we can speed up NumPy functions internally by
using non-dispatched functions (with ``.__wrapped__``).
Diffstat (limited to 'numpy/core/overrides.py')
-rw-r--r-- | numpy/core/overrides.py | 18 |
1 files changed, 0 insertions, 18 deletions
diff --git a/numpy/core/overrides.py b/numpy/core/overrides.py index c55174ecd..46097f39c 100644 --- a/numpy/core/overrides.py +++ b/numpy/core/overrides.py @@ -8,10 +8,6 @@ from numpy.core._multiarray_umath import ( from numpy.compat._inspect import getargspec -ENABLE_ARRAY_FUNCTION = bool( - int(os.environ.get('NUMPY_EXPERIMENTAL_ARRAY_FUNCTION', 0))) - - add_docstring( implement_array_function, """ @@ -141,16 +137,6 @@ def array_function_dispatch(dispatcher, module=None, verify=True, Function suitable for decorating the implementation of a NumPy function. """ - if not ENABLE_ARRAY_FUNCTION: - # __array_function__ requires an explicit opt-in for now - def decorator(implementation): - if module is not None: - implementation.__module__ = module - if docs_from_dispatcher: - add_docstring(implementation, dispatcher.__doc__) - return implementation - return decorator - def decorator(implementation): if verify: verify_matching_signatures(implementation, dispatcher) @@ -167,10 +153,6 @@ def array_function_dispatch(dispatcher, module=None, verify=True, if module is not None: public_api.__module__ = module - # TODO: remove this when we drop Python 2 support (functools.wraps - # adds __wrapped__ automatically in later versions) - public_api.__wrapped__ = implementation - return public_api return decorator |