After reading http://www.effbot.org/zone/python-objects.htm I was left with this question:
In python, if it a=1
creates an integer object and associates it with a name a
, b=[]
creates an empty list object and associates it with a name b
, which happens when I call, for example. c=[1]
?
I assume this creates a list object and associates it with a name c
, but how exactly is it processed 1
? What does the actual contents of the object list under the hood look like? Does it consist of an integer object or a reference to a "separate" integer object? Can one think, for example, about the c[0]
name associated with a list item?
What about the following:
d=1
e=[d]
Will the contents of the object list (with name e
) be a reference to an integer object with a name d
or a new integer object?
I think the answer lies in this quote from Mr. Lund from the source mentioned above, but I'm still a little confused:
, . , , .
, : Python; ?, .