On Sun, Jun 16, 2013 at 2:47 PM, Ferrous Cranus <supp...@superhost.gr> wrote: > On 16/6/2013 2:13 μμ, Jussi Piitulainen wrote: >> >> If, instead of the above, you have >> >> a = 6 >> b = a >> b = 5 >> >> you will find that b == 5 and a == 6. So b is not the same as a. Else >> one would have changed when the other changed. I would say that a and >> b are different variables. They had the same value, briefly. > > > If they were different variables then they would have different memory > addresses and they would act like two different objects. > > But... both a and b are for a fact mappings for the same memory address as > seen form the following command. > >>>> id(a) == id(b) > True > > They are like the same object with 2 different names.
This will depend on when the test is run: a = 6 b = a a is b # True b = 5 a is b # False The latter is false because the binding of "b" to the int 6 was broken in order to bind b to the int 5. I might also suggest you restrain from trying to correct respondents on these matters until you yourself understand them. It's only polite. Michael -- http://mail.python.org/mailman/listinfo/python-list