Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The method in Python's Pool Map may return certain dictionaries twice when the input list contains duplicate items. Since the map function is executed in parallel, each worker process may process the same item and return the same result. In this case, the result is duplicated in the output list. One solution to avoid duplicates is to remove the duplicates from the input list before applying the map function. Another solution is to use the Pool's map_async method instead of the map method, which returns the results in the order they were submitted, but this may not be suitable for all use cases.