[NumPy-Tickets] [NumPy] #2059: Numpy float plus/times poly1d gives array
NumPy Trac
numpy-tickets@scipy....
Mon Feb 20 17:34:44 CST 2012
#2059: Numpy float plus/times poly1d gives array
------------------------+---------------------------------------------------
Reporter: ezander | Owner: somebody
Type: defect | Status: new
Priority: normal | Milestone: Unscheduled
Component: numpy.core | Version: 1.5.1
Keywords: |
------------------------+---------------------------------------------------
Comment(by ezander):
Seems to happen whenever the second multiplicant implements {{{__len__}}}
and {{{__getitem__}}} e.g.
{{{
In [2]: class foo(object):
...: def __len__(self):
...: return 5
...: def __getitem__(self,i):
...: return 2*i
...: def __rmul__(self,other):
...: return self
In [4]: import numpy as np
In [6]: np.float64(3)*foo()
Out[6]: array([ 0., 6., 12., 18., 24.])
}}}
Maybe numpy.float64 should first give {{{__rmul__}}} a chance, if it's
defined?
--
Ticket URL: <http://projects.scipy.org/numpy/ticket/2059#comment:3>
NumPy <http://projects.scipy.org/numpy>
My example project
More information about the NumPy-Tickets
mailing list