dictA = {'a':1, 'b':2, 'c':3}
preA = {}
print hex(id(preA))
preB = {}
print hex(id(preB))
dicts = [preA, preB] #<---- looks like I can't save it like this?
for d in dicts:
print hex(id(d))
d = dictA
print preA
print preB
OUTPUT:
0x13348b0
0x13357f0
0x13348b0
0x13357f0
{}
{}
Looks like it has same memory address but when I set preA
or preB
via the variable 'd
' and getting the value back from preA
or preB
, it's as if they were never set.
Can anyone explain whats going on here?