for a in range(2):
print(id({})) # 2444803983552, 2444803983552
for a in range(2):
obj = {}
print(id(obj)) # 2347467557056, 2347469009408
Why does it work so? I thought that in both ways dict would relate to different memory units
for a in range(2):
print(id({})) # 2444803983552, 2444803983552
for a in range(2):
obj = {}
print(id(obj)) # 2347467557056, 2347469009408
Why does it work so? I thought that in both ways dict would relate to different memory units