bundles / numpy 2.4.3 / numpy / _core / overrides / array_function_dispatch
function
numpy._core.overrides:array_function_dispatch
source: /numpy/_core/overrides.py :108
Signature
def array_function_dispatch ( dispatcher = None , module = None , verify = True , docs_from_dispatcher = False ) Summary
Decorator for adding dispatch with the __array_function__ protocol.
Extended Summary
See NEP-18 for example usage.
Parameters
dispatcher: callable or NoneFunction that when called like
dispatcher(*args, **kwargs)with arguments from the NumPy function call returns an iterable of array-like arguments to check for__array_function__.If
None, the first argument is used as the singlelike=argument and not passed on. A function implementinglike=must call its dispatcher withlikeas the first non-keyword argument.module: str, optional__module__ attribute to set on new function, e.g.,
module='numpy'. By default, module is copied from the decorated function.verify: bool, optionalIf True, verify the that the signature of the dispatcher and decorated function signatures match exactly: all required and optional arguments should appear in order with the same names, but the default values for all optional arguments should be
None. Only disable verification if the dispatcher's signature needs to deviate for some particular reason, e.g., because the function has a signature likefunc(*args, **kwargs).docs_from_dispatcher: bool, optionalIf True, copy docs from the dispatcher function onto the dispatched function, rather than from the implementation. This is useful for functions defined in C, which otherwise don't have docstrings.
Returns
: Function suitable for decorating the implementation of a NumPy function.
Aliases
-
numpy.fft._helper.array_function_dispatch