different binding behavior

Paul Rubin http
Thu Nov 10 17:32:59 EST 2005


Steven D'Aprano <steve at REMOVETHIScyber.com.au> writes:
> Imagine that ints could be changed in place. Then you could do this:
> 
> x = 0
> x += 1

No nothing like that.  Nothing stops you from having multiple int
objects with the same value.  Lists, for example, are mutable, but

  x = [0,1]
  x += [2,3]

doesn't change what the literal [0,1] means.



More information about the Python-list mailing list