Can someone please explain this to me? This doesn\'t make any sense to me.
I copy a dictionary into another and edit the second and both are changed. Why is this hap
i ran into a peculiar behavior when trying to deep copy dictionary property of class w/o assigning it to variable
new = copy.deepcopy(my_class.a)
doesn't work i.e. modifying new
modifies my_class.a
but if you do old = my_class.a
and then new = copy.deepcopy(old)
it works perfectly i.e. modifying new
does not affect my_class.a
I am not sure why this happens, but hope it helps save some hours! :)