(Sep-21-2017, 07:08 PM)cnoblejr Wrote: Clearly the "stuff" on the right-hand side are objects and have a fixed location. The y and x are just labels that point to the objects.
id()
show identity of an object the number is the object memory address.x any y can both can point to same memory address.
>>> x = 5 >>> y = x >>> id(x) 1434501200 >>> id(y) 1434501200
(Sep-21-2017, 07:08 PM)cnoblejr Wrote: Most books say that variables are like boxes stored somewhere by the compiler/assembler/loader and the items that appear on the right-hand side get placed in the appropriate box.Python dos it an other way than most languages other-languages-have-variables.
Python has "names"
Quote:Seems simpler to think of variables as boxes rather than labels that get hung on (point to) objects.No boxes is more correct to describe how other languages use variables.
This picture show the Python model,that name labels can get hung on same object in memory.
[Image: ab2tag.png]