[SciPy-dev] Suppressing of numpy __mul__, __div__ etc

Alan G Isaac aisaac at american.edu
Sun Dec 13 09:07:58 EST 2009


On 12/13/2009 3:38 AM, Dmitrey wrote:
>      def __mul__(self, i):
>          return asarray(multiply(self, i)) if not getattr(i,
> '_numpyLeftOperatorsOverloaded', False) else i.__rmul__(self)
> vs
>      def __mul__(self, i):
>          return asarray(multiply(self, i)) if not
> isinstance(i,CNumpyLeftOperatorOverloaded) else i.__rmul__(self)
>


I am not at all speaking against this, but I am wondering
what exactly your object is getting out of overriding multiplication.

Also, for clarification, the proposal is not just to override
multiplication, but *all* arithmetic operations. Right?
(The examples have all been multiplication.)

Alan Isaac




More information about the SciPy-Dev mailing list