[Numpy-discussion] Object with __array_priority__ = 1000 invokes __len__ and __get__ item on rmul

John Salvatier jsalvatier@gmail....
Wed Jun 16 15:18:14 CDT 2010


Hello,

I have a class with  __array_priority__ = 1000, and I have found that
multiplying it with a ndarray on the left invokes __len__ and __get__ item
(if the length of the right side > 1) before invoking __rmul__ for my
object. This seems odd to me. I understood that ndarray would defer to
whichever class had the larger __array_priority__. What am I missing?

This behavior is somewhat problematic for me because __getitem__ records the
existence of the objects it creates and holds on to them, so I have extra
objects floating around that I would rather not have. Is there a way I can
stop this?

Best Regards,
 John Salvatier
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20100616/98488a07/attachment.html 


More information about the NumPy-Discussion mailing list