[Numpy-discussion] vectorized methods
Thu Mar 29 00:16:39 CDT 2007
What is the current idiom for vectorizing instance methods? I don't
need vectorization over self. For functions:
from numpy import *
does the right thing. But for instance methods:
self.v = v
def f(self, x):
u = useless(0)
raises an exception:
ValueError: mismatch between python function inputs and received arguments
frompyfunc is possibly more powerful (though it doesn't seem to serve
the purpose either) but the fact that it always returns object arrays
is thoroughly unappealing.
I can create an inner function and vectorize it on every call to f,
but that's not especially efficient or syntactically appealing.
Surely there must be a right way to do this?
Anne M. Archibald
More information about the Numpy-discussion