Python multiprocessing - does the number of processes in a pool decrease on error?
问题 The code: import multiprocessing print(f'num cpus {multiprocessing.cpu_count():d}') import sys; print(f'Python {sys.version} on {sys.platform}') def _process(m): print(m) #; return m raise ValueError(m) args_list = [[i] for i in range(1, 20)] if __name__ == '__main__': with multiprocessing.Pool(2) as p: print([r for r in p.starmap(_process, args_list)]) prints: num cpus 8 Python 3.7.1 (v3.7.1:260ec2c36a, Oct 20 2018, 03:13:28) [Clang 6.0 (clang-600.0.57)] on darwin 1 7 4 10 13 16 19