[Numpy-discussion] ufunc overrides

Blake Griffith blake.a.griffith at gmail.com
Wed Jul 10 23:29:05 EDT 2013


Hello NumPy,

Part of my GSoC is compatibility with SciPy's sparse matrices and NumPy's
ufuncs. Currently there is no feasible way to do this without changing
ufuncs a bit.

I've been considering a mechanism to override ufuncs based on checking the
ufuncs arguments for a __ufunc_override__ attribute. Then handing off the
operation to a function specified by that attribute. I prototyped this in
python and did a demo in a blog post here:
http://cwl.cx/posts/week-6-ufunc-overrides.html
This is similar to a previously discussed, but never implemented change:
http://mail.scipy.org/pipermail/numpy-discussion/2011-June/056945.html

However it seems like the ufunc machinery might be ripped out and replaced
with a true multi-method implementation soon. See Travis' blog post:
http://technicaldiscovery.blogspot.com/2013/07/thoughts-after-scipy-2013-and-specific.html
So I'd like to make my changes as forward compatible as possible. However
I'm not sure what I should even consider here, or how forward compatible my
current implementation is. Thoughts?

Until then, I'm writing up a nep, it is still pretty incomplete, it can be
found here:

https://github.com/cowlicks/numpy/blob/ufunc-override/doc/neps/ufunc-overrides.rst
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20130710/3b213089/attachment.html>


More information about the NumPy-Discussion mailing list