[Numpy-discussion] replacing the mechanism for dispatching ufuncs

Mark Wiebe mwwiebe@gmail....
Wed Jun 22 12:25:53 CDT 2011


On Wed, Jun 22, 2011 at 5:08 AM, Pauli Virtanen <pav@iki.fi> wrote:

> Tue, 21 Jun 2011 16:43:13 -0500, Mark Wiebe wrote:
> [clip: __array_wrap__]
> > Those could stay as they are, and just the ufunc usage of __array_wrap__
> > can be deprecated. For classes which currently use __array_wrap__, they
> > would just need to also implement _numpy_ufunc_ to eliminate any
> > deprecation messages.
>
> Do you mean that the new mechanism would not be able to do
> the same thing here?
>

It would have to be generalized a bit more to support these usages, because
some functions produce outputs with different shapes, and the inputs may not
be broadcast together in the same manner as in the element-wise ufuncs.


> Preservation of array subclasses in linalg functions is not very
> uniform, and will likely need fixes in several of the functions.
> Since new code in any case would need to be written, I'd prefer
> using the "new" approach and so leaving us the option of marking
> the "old" approach deprecated.
>

I think creating a @ufunc_overload(...) decorator for specifying the ufunc
properties like nin and nout might be a nice way to generalize it.

-Mark


>
>        Pauli
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20110622/5fd029a9/attachment.html 


More information about the NumPy-Discussion mailing list