I have the following function
def collect_data4evaluation(self, limit, obj_types):
type_limit = int(round(limit / len(obj_types)))
D = ReverseSearch.load_unreverted_dict()
data_set = []
for obj_type, d in D.items():
if obj_type in obj_types:
data_set = data_set + self.collect_dublication(D=d, obj_type=obj_type, type_limit=type_limit)
random.shuffle(data_set)
return data_set
It goes through items of dictionary and generates the the list of dictionaries according to obj_type and d of D.items()
I want to use multiprocessing to speed it up. Somthing like this
pool = Pool(cpu_count())
data_set += pool.map(self.collect_dublication, D=d, obj_type=obj_type, type_limit=type_limit)
But I don't understand how to iterate over dict items using map function