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 quite a bit off. I always > assumed that 'a *= b' means exactly the same as 'a = a * b' but this is > clearly not the case! > > Yes, it is intentional. Numpy is more C than Python in this case, it actually does the multiplication in-place so that the result must have the same type as the left hand side. In this case Python just creates a new object. <snip> Chuck
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion