Describe the relationship between objects, references, and aliasing. Again, create your own examples with Python lists.
Answers
Explanation:
the variable is created in a python by means of the sign "=" where on the left part there will be a name of a variable and on right values of a variable. The variable and an object in a python are almost equivalent concepts. But there are distinctions as a python there are two types of objects:
1) unchangeable such as numerical data, lines, trains. For example at a privaivaniye pereenny values an object the having some identifier is created:
>>> a=2
>>> id(a)
1407502272
When giving the same variable of new value the identifier changes, that is a new object is created:
>>> a=2
>>> id(a)
1407502272
>>> a=5
>>> id(a)
1407502320
>>>
2) Changeable objects such as lists, dictionaries and mnozhest. For example we will appropriate to the list "a" some value and then we will equate the new variable "b" to "a", having output references to "an" and "b" we will see that they are identical:
>>> a= [1.7]
>>> b=a
>>> print (id(a), id(b))
59042120 59042120
That is els we will add an element to Speke of "b", the list "a" will change too.