In Python I created integer and list objects as follows:
a = 10
b = 10
x = []
y = []
Then I get the following results while comparing the id of a
and b
, and the id of x
and y
id(a)==id(b) returns True
id(x)==id(y) returns False
Somewhere I read that assignment in Python never copies data. My question is why x and y do not have the same id?