I tryed to read something on the topic but I cannot figure out a possible solution.
I have a dictionary of this type:
class flux(object):
def __init__(self, count_flux=0, ip_c_dict=defaultdict(int), ip_s_dict=defaultdict(int), conn_dict=defaultdict(int)):
self.count_flux = count_flux
self.ip_c_dict = ip_c_dict if ip_c_dict is not None else {}
self.ip_s_dict = ip_s_dict if ip_s_dict is not None else {}
self.conn_dict = conn_dict if conn_dict is not None else {}
Every time I try to update the dictionary in this way:
dictionary[key].ip_c_dict[some_string]+=1
not only the dictionary of the current key is updated, but also all the others. And of course it happens with all the three dictionary in the class, ip_c_dict=defaultdict(int), ip_s_dict=defaultdict(int), conn_dict=defaultdict(int).
How can I fix it?