[Numpy-discussion] ndarray special methods should raise NotImplemented instead of TypeError

Hoyt Koepke hoytak at stat.washington.edu
Sun Mar 13 17:53:55 EDT 2011

> You can also define __array_priority__  in your class. If your class isn't a
> subclass, then numpy will always call your class methods whether or not your
> class is on the right or left. Sounds like you don't want to sublass ndarray
> here so that should work.

Excellent!  This sounds like exactly what I was hoping for.  I assume
in my case, I just need __array_priority__ > 10 to gain priority over
a matrix (from reading
http://docs.scipy.org/doc/numpy/reference/arrays.classes.html).  Is
that correct?



+ Hoyt Koepke
+ University of Washington Department of Statistics
+ http://www.stat.washington.edu/~hoytak/
+ hoytak at gmail.com

More information about the NumPy-Discussion mailing list