[Numpy-discussion] NEP: Dispatch Mechanism for NumPy’s high level API

Stephan Hoyer shoyer at gmail.com
Fri Jun 8 20:10:13 EDT 2018


To clarify, by "where_i_am" you mean something like the name of the
argument where it was found?

On Fri, Jun 8, 2018 at 4:49 PM Marten van Kerkwijk <
m.h.vankerkwijk at gmail.com> wrote:

> and in particular how the implementation finds out where its own instances
>>> are located.
>> I think we've discussed this before, but I don't think this is feasible
>> to solve in general given the diversity of wrapped APIs. If you want to
>> find the arguments in which a class' own instances appear, you will need to
>> do that in your overloaded function.
>> That said, if merely pulling out the flat list of arguments that are
>> checked for and/or implement __array_function__ would be enough, we can
>> probably figure out a way to expose that information.
> In the end, somewhere inside the "dance", you are checking for
> `__array_function` - it would seem to me that at that point you know
> exactly where you are, and it would not be difficult to something like
> ```
> types[new_type] += [where_i_am]
> ```
> (where here I assume types is a defaultdict(list))  - has the set of types
> in keys and locations as values.
> But easier to discuss whether this is easy with some sample code to look
> at!
> -- Marten
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at python.org
> https://mail.python.org/mailman/listinfo/numpy-discussion
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20180608/cc2b92cd/attachment.html>

More information about the NumPy-Discussion mailing list