I am declaring a list and checking the reference of the elements in the list. I am able to understand that the "Peter" is stored at 140489131208016, "Bruce" is stored at 140489131207736 and so on and the reference is stored in the list by what is the value that is printed when I do print(id(names))
what does that mean or point to? I searched along a lot of articles, but no clear explanation was provided.
In 'C' if arr = [11, 22, 24]
, arr will hold the address of the number 11, is that any way related to python?
Python code:
names = ["Peter", "Bruce", "Tony"]
print (id(names))
print (id(names[0]))
print (id(names[1]))
print (id(names[2]))
O/P:
140489122463816
140489131208016
140489131207736
140489131206056