[Numpy-discussion] *= operator not intuitive

2011-03-16 Thread Paul Anton Letnes
Hi! This little snippet of code tricked me (in a more convoluted form). The *= operator does not change the datatype of the left hand side array. Is this intentional? It did fool me and throw my results quite a bit off. I always assumed that 'a *= b' means exactly the same as 'a = a * b' but

Re: [Numpy-discussion] *= operator not intuitive

2011-03-16 Thread Angus McMorland
On 16 March 2011 09:24, Paul Anton Letnes paul.anton.let...@gmail.com wrote: Hi! This little snippet of code tricked me (in a more convoluted form). The *= operator does not change the datatype of the left hand side array. Is this intentional? It did fool me and throw my results quite a bit

Re: [Numpy-discussion] *= operator not intuitive

2011-03-16 Thread Dag Sverre Seljebotn
On 03/16/2011 02:24 PM, Paul Anton Letnes wrote: Hi! This little snippet of code tricked me (in a more convoluted form). The *= operator does not change the datatype of the left hand side array. Is this intentional? It did fool me and throw my results quite a bit off. I always assumed

Re: [Numpy-discussion] *= operator not intuitive

2011-03-16 Thread Paul Anton Letnes
Heisann! On 16. mars 2011, at 14.30, Dag Sverre Seljebotn wrote: On 03/16/2011 02:24 PM, Paul Anton Letnes wrote: Hi! This little snippet of code tricked me (in a more convoluted form). The *= operator does not change the datatype of the left hand side array. Is this intentional? It did

Re: [Numpy-discussion] *= operator not intuitive

2011-03-16 Thread Charles R Harris
On Wed, Mar 16, 2011 at 7:24 AM, Paul Anton Letnes paul.anton.let...@gmail.com wrote: Hi! This little snippet of code tricked me (in a more convoluted form). The *= operator does not change the datatype of the left hand side array. Is this intentional? It did fool me and throw my results

Re: [Numpy-discussion] *= operator not intuitive

2011-03-16 Thread Chris Barker
On 3/16/11 6:34 AM, Charles R Harris wrote: On Wed, Mar 16, 2011 at 7:24 AM, Paul Anton Letnes Yes, it is intentional. Numpy is more C than Python in this case, I don't know that C has anything to do with it -- the *= operators were added specifically to be in-place operators -- otherwise

Re: [Numpy-discussion] *= operator not intuitive

2011-03-16 Thread Dag Sverre Seljebotn
On 03/16/2011 02:35 PM, Paul Anton Letnes wrote: Heisann! Hei der, On 16. mars 2011, at 14.30, Dag Sverre Seljebotn wrote: On 03/16/2011 02:24 PM, Paul Anton Letnes wrote: Hi! This little snippet of code tricked me (in a more convoluted form). The *= operator does not change the

Re: [Numpy-discussion] *= operator not intuitive

2011-03-16 Thread Paul Anton Letnes
On 16. mars 2011, at 15.49, Chris Barker wrote: On 3/16/11 6:34 AM, Charles R Harris wrote: On Wed, Mar 16, 2011 at 7:24 AM, Paul Anton Letnes Yes, it is intentional. Numpy is more C than Python in this case, I don't know that C has anything to do with it -- the *= operators were added

Re: [Numpy-discussion] *= operator not intuitive

2011-03-16 Thread Paul Anton Letnes
On 16. mars 2011, at 15.57, Dag Sverre Seljebotn wrote: On 03/16/2011 02:35 PM, Paul Anton Letnes wrote: Heisann! Hei der, On 16. mars 2011, at 14.30, Dag Sverre Seljebotn wrote: On 03/16/2011 02:24 PM, Paul Anton Letnes wrote: Hi! This little snippet of code tricked me (in a more

Re: [Numpy-discussion] *= operator not intuitive

2011-03-16 Thread Charles R Harris
On Wed, Mar 16, 2011 at 8:58 AM, Paul Anton Letnes paul.anton.let...@gmail.com wrote: On 16. mars 2011, at 15.49, Chris Barker wrote: On 3/16/11 6:34 AM, Charles R Harris wrote: On Wed, Mar 16, 2011 at 7:24 AM, Paul Anton Letnes Yes, it is intentional. Numpy is more C than Python in

Re: [Numpy-discussion] *= operator not intuitive

2011-03-16 Thread Paul Anton Letnes
This comes up for discussion on a fairly regular basis. I tend towards the more warnings side myself, but you aren't going to get the current behavior changed unless you can convince a large bunch of people that it is the right thing to do, which won't be easy. For one thing, a lot of

Re: [Numpy-discussion] *= operator not intuitive

2011-03-16 Thread Christopher Barker
On 3/16/11 9:22 AM, Paul Anton Letnes wrote: This comes up for discussion on a fairly regular basis. I tend towards the more warnings side myself, but you aren't going to get the current behavior changed unless you can convince a large bunch of people that it is the right thing to do,