Re: [Numpy-discussion] Multiplying numpy floats and python lists

2010-06-20 Thread Tony S Yu
On Jun 20, 2010, at 2:28 PM, Pauli Virtanen wrote: > su, 2010-06-20 kello 13:56 -0400, Tony S Yu kirjoitti: >> I came across some strange behavior when multiplying numpy floats and >> python lists: the list is returned unchanged: >> >>> In [18]: np.float64(1.2) * [1, 2] >>> >>> Out[18]: [1, 2]

Re: [Numpy-discussion] Multiplying numpy floats and python lists

2010-06-20 Thread Pauli Virtanen
su, 2010-06-20 kello 13:56 -0400, Tony S Yu kirjoitti: > I came across some strange behavior when multiplying numpy floats and > python lists: the list is returned unchanged: > > > In [18]: np.float64(1.2) * [1, 2] > > > > Out[18]: [1, 2] Probably a bug, it seems to round the result first to an

Re: [Numpy-discussion] Multiplying numpy floats and python lists

2010-06-20 Thread Warren Weckesser
Tony S Yu wrote: > I came across some strange behavior when multiplying numpy floats and python > lists: the list is returned unchanged: > > >> In [18]: np.float64(1.2) * [1, 2] >> >> Out[18]: [1, 2] >> > > Apparently the np.float64 object is cast to an int, and python's * is used: In

[Numpy-discussion] Multiplying numpy floats and python lists

2010-06-20 Thread Tony S Yu
I came across some strange behavior when multiplying numpy floats and python lists: the list is returned unchanged: > In [18]: np.float64(1.2) * [1, 2] > > Out[18]: [1, 2] On the other hand, multiplying an array scalar and a python list gives the expected answer > In [19]: np.array(1.2) * [1,