[Numpy-discussion] ufunc delegation to object method
Mon Jan 30 01:17:27 CST 2012
In the following code, numpy.sin() calls the object's sin() function:
In : class Foo(object):
...: def sin(self):
...: return "spam"
In : f = Foo()
In : np.sin(f)
Is this, in fact, guaranteed behavior for a ufunc? It does not appear to
This question came up in the discussion of SciPy pull request 138 (
https://github.com/scipy/scipy/pull/138), where the idea is to add numpy
unary ufunc support to SciPy's sparse arrays.
(Sorry if this email shows up twice. I sent it the first time while the
Enthought servers were down, and eventually got an email back saying it had
not been sent.)
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion