I have a problem where I have a function that may or may not alter the values of a dictionary, and I want to keep track of those alterations with another function. It looks something like this:
dict_t0 = my_dict
function_that_alters_values(my_dict)
dict_t1 = my_dict
compare_dicts(dict_t0,dict_t1)
However, since dict_t0
simply points to the object my_dict
, any changes made to my_dict
would be applied to dict_t0
, which is why I tried using
dict_t0 = deepcopy(my_dict)
However, this gives me the following error:
RecursionError: maximum recursion depth exceeded
Is there a better way to solve my problem?