[Numpy-discussion] replacing the mechanism for dispatching ufuncs
Lluís
xscript at gmx.net
Wed Jun 22 08:34:26 EDT 2011
Darren Dale writes:
> On Tue, Jun 21, 2011 at 1:57 PM, Mark Wiebe <mwwiebe at gmail.com> wrote:
>> On Tue, Jun 21, 2011 at 12:36 PM, Charles R Harris
>> <charlesr.harris at gmail.com> 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_"
attribute).
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
overloading loop.
Lluis
--
"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
Tollbooth
More information about the NumPy-Discussion
mailing list