On Wed, Apr 24, 2019 at 9:45 PM Stephan Hoyer <sho...@gmail.com> wrote:
> With "__numpy_implementation__" I was hoping to evoke "the implementation 
> used by numpy.ndarray.__array_function__" and "the implementation for NumPy 
> arrays" rather than "the implementation found in the NumPy library." So it 
> would still be appropriate to use on functions defined in SciPy, as long as 
> they are defined on NumPy arrays.
>
> That said, this is clearly going to remain a source of confusion. So let's 
> see if we can do better.
>
> Taking a step back, there will be three generic parts to NumPy functions 
> after NEP-18:
> 1. Dispatching with __array_function__
> 2. Coercion to NumPy arrays (sometimes skipped if an object has the necessary 
> duck-typing methods)
> 3. Implementation (either in C or is terms of other NumPy functions/methods)
>
> Currently, NumPy functions do steps (2) and (3) together. What we're asking 
> for here is a way to continue this behavior in the future, by optionally 
> skipping step (1). But in the future, as Marten notes below, we should not 
> rule out cases where we also want to skip straight to step (3), without step 
> (2).
>
> "__skipping_array_function__"  would be a reasonable choice, though it does 
> not evoke the "numpy array specific"  aspect that I want to emphasis. Also, 
> it has the unfortunate aspect of being named after what it doesn't do, rather 
> than what it does.
>
> "__numpy_ndarray_implementation__" and "__numpy_array_implementation__" are a 
> bit verbose, but maybe they would be better?

When you say "numpy array specific" and
"__numpy_(nd)array_implementation__", that sounds to me like you're
trying to say "just step 3, skipping steps 1 and 2"? Step 3 is the one
that operates on ndarrays...

When we have some kind of __asduckarray__ coercion, then that will
complicate things too, because presumably we'll do something like

1. __array_function__ dispatch
2. __asduckarray__ coercion
3. __array_function__ dispatch again
4. ndarray coercion
5. [either "the implementation", or __array_function__ dispatch again,
depending on how you want to think about it]

-n

-- 
Nathaniel J. Smith -- https://vorpus.org
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@python.org
https://mail.python.org/mailman/listinfo/numpy-discussion

Reply via email to