<div dir="ltr">Yes! It works. Thanks so much!</div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Mar 24, 2018 at 3:59 PM, Ilhan Polat <span dir="ltr"><<a href="mailto:ilhanpolat@gmail.com" target="_blank">ilhanpolat@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Yes, you can write <br><br><code>__array_priority__</code> = 1000 # some number (bigger wins. But against what you can never be sure)<br><br>or <br><br><code>__array_ufunc__ = None
#
NumPy 1.13+ only</code><br><br></div>somewhere in your class and NumPy will leave you alone because this overrides its eagerness to handle the vectorization and ending up on object data types.<br><br><br></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Sat, Mar 24, 2018 at 10:02 PM, Phillip Feldman <span dir="ltr"><<a href="mailto:phillip.m.feldman@gmail.com" target="_blank">phillip.m.feldman@gmail.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr">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<div><br></div><div>Phillip<br><div><br></div><div><div><font face="monospace, monospace"> def __rmul__(self, c):</font></div><div><font face="monospace, monospace"> S= self.copy()<br></font></div><div><font face="monospace, monospace"> S.phasors*= c<br></font></div><div><font face="monospace, monospace"> return S</font></div></div></div></div>
<br></div></div>______________________________<wbr>_________________<br>
SciPy-Dev mailing list<br>
<a href="mailto:SciPy-Dev@python.org" target="_blank">SciPy-Dev@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/scipy-dev" rel="noreferrer" target="_blank">https://mail.python.org/mailma<wbr>n/listinfo/scipy-dev</a><br>
<br></blockquote></div><br></div>
<br>______________________________<wbr>_________________<br>
SciPy-Dev mailing list<br>
<a href="mailto:SciPy-Dev@python.org">SciPy-Dev@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/scipy-dev" rel="noreferrer" target="_blank">https://mail.python.org/<wbr>mailman/listinfo/scipy-dev</a><br>
<br></blockquote></div><br></div>