[Numpy-discussion] core library structure

Darren Dale dsdale24@gmail....
Fri Feb 4 13:46:01 CST 2011


On Fri, Feb 4, 2011 at 2:23 PM, Lluís <xscript@gmx.net> wrote:
> Darren Dale writes:
>
>> With generic functions, you wouldn't have to remember to use the ufunc
>> provided by masked array for one type, or the default numpy for
>> another type.
>
> Sorry, but I don't see how generic functions should be a better approach
> compared to redefining methods on masked_array [1]. In both cases you
> have to define them one-by-one.
>
> [1] assuming 'np.foo' and 'ma.foo' (which would now be obsolete) simply
>    call 'instance.foo', which in the ndarray level is the 'foo' ufunc
>    object.

That's a bad assumption. np.ndarray.__add__ actually calls the np.add
ufunc, not the other way around. For example, np.arcsin is a ufunc
that operates on ndarray, yet there is no ndarray.arcsin method.

Darren


More information about the NumPy-Discussion mailing list