[SciPy-Dev] how to multiply an instance of ndarray and an object?
Phillip Feldman
phillip.m.feldman at gmail.com
Sat Mar 24 17:02:50 EDT 2018
I have a class called `Signal` that handles multiplication by an array on
the right by overloading `__mul__`. I tried to implement multiplication by
an array on the left by overloading `__rmul__`, but wasn't able to make
this work because NumPy thinks that it knows how to handle this, so my
`__rmul__` method (below) is never called. The result is an array having
dtype `object`. Is there a practical way to modify NumPy to solve this
problem
Phillip
def __rmul__(self, c):
S= self.copy()
S.phasors*= c
return S
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scipy-dev/attachments/20180324/87aeeda1/attachment.html>
More information about the SciPy-Dev
mailing list