<p dir="auto"><em>Original ticket <a href="http://projects.scipy.org/numpy/ticket/1136" rel="nofollow">http://projects.scipy.org/numpy/ticket/1136</a> on 2009-06-10 by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/b45ch1/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/b45ch1">@b45ch1</a>, assigned to unknown.</em></p>
<p dir="auto">This is best explained by the following example:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="class adouble:
      def __init__(self,x):
              self.x = x
      def __mul__(self,rhs):
              if isinstance(rhs,adouble):
                      return adouble(self.x * rhs.x)
              else:
                      return adouble(self.x * rhs)
      def __str__(self):
              return str(self.x)

x = adouble(3.)
y = adouble(2.)
u = array([adouble(3.), adouble(5.)])
v = array([adouble(2.), adouble(7.)])
z = array([2.,3.])

print 'numpy.__version__=',numpy.__version__
print x * y              # ok
print u * v              # ok
print u * z              # ok
print u * 3.             # ok
print u * z[0]           # _NOT_ OK!
print u * float64(3.)    # _NOT_ OK!"><pre class="notranslate"><code class="notranslate">class adouble:
      def __init__(self,x):
              self.x = x
      def __mul__(self,rhs):
              if isinstance(rhs,adouble):
                      return adouble(self.x * rhs.x)
              else:
                      return adouble(self.x * rhs)
      def __str__(self):
              return str(self.x)

x = adouble(3.)
y = adouble(2.)
u = array([adouble(3.), adouble(5.)])
v = array([adouble(2.), adouble(7.)])
z = array([2.,3.])

print 'numpy.__version__=',numpy.__version__
print x * y              # ok
print u * v              # ok
print u * z              # ok
print u * 3.             # ok
print u * z[0]           # _NOT_ OK!
print u * float64(3.)    # _NOT_ OK!
</code></pre></div>
<p dir="auto">Output:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="basti@shlp:~/tmp$ python numpy_float64_issue.py
numpy.__version__= 1.4.0.dev7039
6.0
[6.0 35.0]
[6.0 15.0]
[9.0 15.0]
Traceback (most recent call last):
 File &quot;numpy_float64_issue.py&quot;, line 26, in &lt;module&gt;
   print u * z[0]           # _NOT_ OK!
TypeError: unsupported operand type(s) for *: 'numpy.ndarray' and
'numpy.float64'"><pre class="notranslate"><code class="notranslate">basti@shlp:~/tmp$ python numpy_float64_issue.py
numpy.__version__= 1.4.0.dev7039
6.0
[6.0 35.0]
[6.0 15.0]
[9.0 15.0]
Traceback (most recent call last):
 File "numpy_float64_issue.py", line 26, in &lt;module&gt;
   print u * z[0]           # _NOT_ OK!
TypeError: unsupported operand type(s) for *: 'numpy.ndarray' and
'numpy.float64'
</code></pre></div>
<p dir="auto"><em>Original ticket <a href="http://projects.scipy.org/numpy/ticket/1150" rel="nofollow">http://projects.scipy.org/numpy/ticket/1150</a> on 2009-06-25 by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/inducer/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/inducer">@inducer</a>, assigned to unknown.</em></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Python 2.5.4 (r254:67916, Feb 18 2009, 03:00:47) 
[GCC 4.3.3] on linux2
Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.
&gt;&gt;&gt; import numpy
&gt;&gt;&gt; numpy.__version__
'1.3.0'
&gt;&gt;&gt; numpy.zeros(5, dtype=object)*5.
array([0.0, 0.0, 0.0, 0.0, 0.0], dtype=object)
&gt;&gt;&gt; numpy.zeros(5, dtype=object)*numpy.float64(5)
Traceback (most recent call last):
  File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;
TypeError: unsupported operand type(s) for *: 'numpy.ndarray' and 'numpy.float64'"><pre class="notranslate"><code class="notranslate">Python 2.5.4 (r254:67916, Feb 18 2009, 03:00:47) 
[GCC 4.3.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
&gt;&gt;&gt; import numpy
&gt;&gt;&gt; numpy.__version__
'1.3.0'
&gt;&gt;&gt; numpy.zeros(5, dtype=object)*5.
array([0.0, 0.0, 0.0, 0.0, 0.0], dtype=object)
&gt;&gt;&gt; numpy.zeros(5, dtype=object)*numpy.float64(5)
Traceback (most recent call last):
  File "&lt;stdin&gt;", line 1, in &lt;module&gt;
TypeError: unsupported operand type(s) for *: 'numpy.ndarray' and 'numpy.float64'
</code></pre></div>