Description
Hi there 👋🏻
I opened this issue to discuss one particular use case we, at MadMiner, are having trouble with.
We have a custom vector class, MadMinerParticle, overriding some of the protocol methods coming from its parent class MomentumVector4D
(which, in reality, inherits them from VectorObject
). When using one of these methods (our trouble is with __iadd__
), we noticed that the operation makes use of the __array_ufunc__ method, which calls the _handler_of dispatch function, obtaining the module in which the provided object class was defined.
Lines 2547 to 2553 in d9cd956
The problem is that, with a custom VectorObject
subclass, the module information points to a Python module that is on the client code, and therefore, not recognized among the valid list of modules.
Lines 2529 to 2533 in d9cd956
Could you expand the logic on the _handler_of dispatch function so that, not only the object's type __module__
gets looked up, but the complete list of parent classes in MRO order?
Thanks in advance.