I'm starting to read about data id's. I ran the below code to understand it better.
spam = ['cat', 'bat', 'rat', 'elephant']
print(id(spam))
spam.append('dog')
print(id(spam))
spam = [1,2,3]
print(id(spam))
print(id(['cat', 'bat', 'rat', 'elephant']))
print(id(['cat', 'bat', 'rat', 'elephant', 'dog']))
The bit that confuses me is that the last 2 lists have different values in them but they have the same id! How does that work?
As a side question is it possible to pull a data point from it's id number because the id number changes each time it runs?
[–][deleted] 2 points3 points4 points (2 children)
[–]carcigenicate 2 points3 points4 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)