[Numpy-discussion] replacing the mechanism for dispatching ufuncs
Wed Jun 22 07:34:26 CDT 2011
Darren Dale writes:
> On Tue, Jun 21, 2011 at 1:57 PM, Mark Wiebe <email@example.com> wrote:
>> On Tue, Jun 21, 2011 at 12:36 PM, Charles R Harris
>> <firstname.lastname@example.org> wrote:
>>> How does the ufunc get called so it doesn't get caught in an endless loop?
>> The function being called needs to ensure this, either by extracting a raw
>> ndarray from instances of its class, or adding a 'subok = False' parameter
>> to the kwargs.
> I didn't understand, could you please expand on that or show an example?
As I understood the initial description and examples, the ufunc overload
will keep being used as long as its arguments are of classes that
declare ufunc overrides (i.e., classes with the "_numpy_ufunc_"
Thus Mark's comment saying that you have to either transform the
arguments into raw ndarrays (either by creating new ones or passing a
view) or use the "subok = False" kwarg parameter to break a possible
"And it's much the same thing with knowledge, for whenever you learn
something new, the whole world becomes that much richer."
-- The Princess of Pure Reason, as told by Norton Juster in The Phantom
More information about the NumPy-Discussion