All:
a = 1
b = a
c = b
Now I want to get a list of object 1 tagged, which is [a, b, c]. How could I do this?
BTW, how to call variable "a" here officially? I know so far it is a "object tag" for the object, but I have no idea what is the term of it.
Thanks!
why do I need this:
a = b = c = 1
print a, b, c
1 1 1
a = 2
print a, b, c
2 1 1
in other language such as C, a,b,c should be 2 if I re-assign a = 2, but in python, there's no such thing like reference, so the only way to change all the value of a b c is a = b = c = 2 so far as I know, that is why purposed to get all reference of an object.
bandcare not altered when you change the value ofais because theinttype is immutable. You'd need a simple container before you could do it like that.intis immutable. If those were objects, you'd still have the same effect.ais being reassigned to something different, butbandcaren't touched. Ifawas an object and you modified a property ofa, then the other 2 would be updated as well.