How to create a synchronized object with Python multiprocessing?
问题 I am trouble figuring out how to make a synchronized Python object. I have a class called Observation and a class called Variable that basically looks like (code is simplified to show the essence): class Observation: def __init__(self, date, time_unit, id, meta): self.date = date self.time_unit = time_unit self.id = id self.count = 0 self.data = 0 def add(self, value): if isinstance(value, list): if self.count == 0: self.data = [] self.data.append(value) else: self.data += value self.count +=