[Numpy-discussion] NEP: Dispatch Mechanism for NumPy’s high level API
einstein.edison at gmail.com
Sun Jun 3 14:52:43 EDT 2018
I also am not sure there is an actual problem: In the scheme as proposed,
implementations could just coerce themselves to array and call the routine
again. (Or, in the scheme I proposed, call the routine again but with
Ah, I didn’t think of the first solution. `coerce=True` may not produce the
desired solution in cases where some arguments can be coerced and some
However, such a design may still have some benefits. For example:
- ``array1.HANDLED_TYPES = [array1]``
- ``array2.HANDLED_TYPES = [array1, array2]``
- ``array1`` is coercible.
- None of these is a sub/super class of the other or of ``ndarray``
- When calling ``np.func(array1(), array2())``, ``array1`` would be
coerced with your solution (because of the left-to-right rule and
``array1`` choosing to coerce itself) but not with
I think that in the proposed scheme this is effectively what happens.
Not really, the current scheme is unclear on what happens if none of the
arguments implement ``__array_function__`` (or at least it doesn’t
explicitly state it that I can see).
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion