I have the following code snippet:
modelLite.environments = model.environments
for k,v in modelLite.environments.iteritems():
v.grid = dict(copy.deepcopy(v.grid))
model.environments is a dictionary mapping strings to Grid objects. (Grid is my custom class) Each Grid object contains a grid attribute, which is a default dict.
In modelLite, I am trying to convert each defaultDict grid attribute to its corresponding dict object.
However, what I find is that the defaultDict object in model.environments are also being cast to dict alongside those in modelLite, despite using copy.deepcopy.
Any advice?