Re: [Numpy-discussion] __iadd__(ndarrayint, ndarrayfloat)

2008-03-25 Thread Nadav Horesh
-הודעה מקורית- מאת: [EMAIL PROTECTED] בשם Andreas Kl?ckner נשלח: ג 25-מרץ-08 06:42 אל: Discussion of Numerical Python נושא: Re: [Numpy-discussion] __iadd__(ndarrayint, ndarrayfloat) On Montag 24 M?rz 2008, St?fan van der Walt wrote: I think this is highly undesirable and should

Re: [Numpy-discussion] __iadd__(ndarrayint, ndarrayfloat)

2008-03-25 Thread Andreas Klöckner
On Dienstag 25 März 2008, Nadav Horesh wrote: scalars are immutable objects in python. Thus the += (and alike) are fake: Again, thanks for the explanation. IMHO, whether or not they are fake is an implementation detail. You shouldn't have to know Python's guts to be able to use Numpy

Re: [Numpy-discussion] __iadd__(ndarrayint, ndarrayfloat)

2008-03-25 Thread Christopher Barker
Andreas Klöckner wrote: [snip] a += 3 is really equivalent to a = a+3. Except when it isn't. right -- it isn't the same. In fact, if I were king (or BDFL), you wouldn't be able to use += with immutable types, but I'm not ;-) One of the reasons the augmented assignment operators where

[Numpy-discussion] __iadd__(ndarrayint, ndarrayfloat)

2008-03-24 Thread Andreas Klöckner
Hi all, I just got tripped up by this behavior in Numpy 1.0.4: u = numpy.array([1,3]) v = numpy.array([0.2,0.1]) u+=v u array([1, 3]) I think this is highly undesirable and should be fixed, or at least warned about. Opinions? Andreas signature.asc Description: This is a digitally

Re: [Numpy-discussion] __iadd__(ndarrayint, ndarrayfloat)

2008-03-24 Thread Stéfan van der Walt
Hi Andreas On Mon, Mar 24, 2008 at 7:28 PM, Andreas Klöckner [EMAIL PROTECTED] wrote: I just got tripped up by this behavior in Numpy 1.0.4: u = numpy.array([1,3]) v = numpy.array([0.2,0.1]) u+=v u array([1, 3]) I think this is highly undesirable and should be fixed, or at

Re: [Numpy-discussion] __iadd__(ndarrayint, ndarrayfloat)

2008-03-24 Thread Andreas Klöckner
On Montag 24 März 2008, Stéfan van der Walt wrote: I think this is highly undesirable and should be fixed, or at least warned about. Opinions? I know the result is surprising, but it follows logically. You have created two integers in memory, and now you add 0.2 and 0.1 to both -- not

Re: [Numpy-discussion] __iadd__(ndarrayint, ndarrayfloat)

2008-03-24 Thread Travis E. Oliphant
Andreas Klöckner wrote: On Montag 24 März 2008, Stéfan van der Walt wrote: I think this is highly undesirable and should be fixed, or at least warned about. Opinions? I know the result is surprising, but it follows logically. You have created two integers in memory, and now you

Re: [Numpy-discussion] __iadd__(ndarrayint, ndarrayfloat)

2008-03-24 Thread Andreas Klöckner
On Dienstag 25 März 2008, Travis E. Oliphant wrote: Question: If it's a known trap, why not change it? It also has useful applications. Also, it can only happen at with a bump in version number to 1.1 I'm not trying to make the functionality go away. I'm arguing that int_array +=