[Numpy-discussion] Revised NEP-18, array_function protocol (original) (raw)

Marten van Kerkwijk m.h.vankerkwijk at gmail.com
Thu Jun 28 08:37:41 EDT 2018


On Wed, Jun 27, 2018 at 3:50 PM, Stephan Hoyer <shoyer at gmail.com> wrote:

So perhaps it's worth "future proofing" the interface by passing obj and method to arrayfunction rather than only func. It is slower to call a func via func.call than func, but only very marginally (~100 ns in my tests).

That would make it more similar yet to __array_ufunc__, but I'm not sure how useful it is, as you cannot generically assume the methods have the same arguments and hence they need their own dispatcher. Once you're there you might as well pass them on directly (since any callable can be used as the function). Indeed, for __array_ufunc__, this might not have been a bad idea either...

-- Marten -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20180628/3d71203f/attachment.html>



More information about the NumPy-Discussion mailing list