Open
Description
I have the following code:
import p_tqdm
d = dict()
def modify_dict(a):
d[a] = a ** 2
p_tqdm.p_map(modify_dict, list(range(10)))
print(d)
It outputs {}
instead of {0: 0, 1: 1, 2: 4, 3: 9, 4: 16, 5: 25, 6: 36, 7: 49, 8: 64, 9: 81}
.
In comparasion, concurrent.futures
works as expected:
import concurrent.futures
with concurrent.futures.ThreadPoolExecutor(max_workers=50) as executor:
executor.map(modify_dict, list(range(10)))
Metadata
Metadata
Assignees
Labels
No labels