On Thu, 10 Nov 2005 22:43:53 +0100, Gabriel Zachmann wrote: > It seems to me that the following behavior of python (2.4.1) is inconsistent:
We've just had a HUGE thread arguing about this behaviour, just three or five days ago. Let's not start it again. In a nutshell, the behaviour is because ints are immutable and can't be changed in place, and lists are mutable and can be changed in place. Imagine that ints could be changed in place. Then you could do this: x = 0 x += 1 Now the int 0 has the value of 1. So: print 2 + 0 => prints 3 Confusion and horror. So of course x += 1 can't change the int in place, it has to rebind x to a new int. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list