[Numpy-discussion] Proposal to accept NEP-18, __array_function__ protocol

Nathaniel Smith njs at pobox.com
Fri Aug 24 16:24:53 EDT 2018


On Fri, Aug 24, 2018, 09:07 Hameer Abbasi <einstein.edison at gmail.com> wrote:

>
>
> On Fri, Aug 24, 2018 at 5:55 PM Stephan Hoyer <shoyer at gmail.com> wrote:
>
>> On Thu, Aug 23, 2018 at 1:06 PM Hameer Abbasi <einstein.edison at gmail.com>
>> wrote:
>>
>>> I might add that if it’s a mandatory part of the protocol, then not all
>>> things will work. For example, if XArray and Dask want to support sparse
>>> arrays, they’ll need to add an explicit dependency.
>>>
>>
>> I don't follow -- can you please elaborate?
>>
>
> If we make specifying __array_function_types__ a mandatory part -- And
> such that it is a whitelist, the XArray or Dask would need to import sparse
> in order to specify that they accept mixing sparse arrays with native
> arrays (i.e. for adding sparse.SparseArray to __array_function_types__).
> Which is basically what I mean. It might be a 'soft' dependency, but there
> will be a dependency nonetheless.
>

Oh yeah, if we did this then we definitely wouldn't want to make it
mandatory. Some `__array_function__` implementations might want to do
checking another way, or support different types in different overloaded
functions, or be able to handle arbitrary types.

-n
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20180824/9df67667/attachment.html>


More information about the NumPy-Discussion mailing list