[Numpy-discussion] ufunc overrides

Nathaniel Smith njs at pobox.com
Wed Jul 17 10:25:43 EDT 2013


On Thu, Jul 11, 2013 at 4:29 AM, Blake Griffith
<blake.a.griffith at gmail.com> wrote:
>
> 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

I've just posted long comment with a slightly different proposal in the PR:
  https://github.com/numpy/numpy/pull/3524#issuecomment-21115548
Mentioning this here because this has the potential to majorly affect
anyone working with ndarray subclasses or other array-like objects
(e.g., masked arrays, GPU arrays, etc.), so if you care about these
things then please take a look and help us make sure that the final
API is flexible enough to handle your needs.

-n



More information about the NumPy-Discussion mailing list