On Jan 12, 1:36 am, "Timothy Hochberg" <[EMAIL PROTECTED]> wrote: > I believe that you need to look at __array_finalize__ and __array_priority__ > (and there may be one other thing as well, I can't remember; it's late). > Search for __array_finalize__ and that will probably help get you started. >
Well sonovagun! I removed the hack. Then just by setting __array_priority__ = 20.0 in the class body, things are magically working almost as I expect. I say "almost" because of this custom method: def cross(self, other): """Cross product of this vector and another vector""" return _N.cross(self, other, axis=0) That call to numpy.cross returns a numpy.ndarray. Unless I do return Vector(_N.cross(self, other, axis=0)), I get problems downstream. When is __array_finalize__ called? By adding some print traces, I can see it's called every time an array is modified in any way i.e., reshaped, transposed, etc., and also during operations like u+v, u-v, A*u. But it's not called during the call to numpy.cross. Why? Cheers, -Basilisk96 _______________________________________________ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion