Bug in __imul__

Chris Gonnerman chris.gonnerman at newcenturycomputers.net
Wed Jul 11 08:53:14 EDT 2001


----- Original Message ----- 
From: "Emile van Sebille" <emile at fenx.com>


> Does it bother anyone that 
> 
> a *= 3 + 4
> 
> returns a different value from
> 
> a = a * 3 + 4
> 
> ??

The behavior of *= is consistent between Python and C (where it was
borrowed from).  Remember to imagine that there are parenthesis around
the RHS of the *= operator.

In other words:

    a *= 3 + 4   !=   a = a * 3 + 4

    a *= 3 + 4   ==   a = a * (3 + 4)







More information about the Python-list mailing list