Python: How to use Value and Array in Multiprocessing pool
问题 For multiprocessing with Process , I can use Value, Array by setting args param. With multiprocessing with Pool , how can I use Value, Array. There is nothing in the docs on how to do this. from multiprocessing import Process, Value, Array def f(n, a): n.value = 3.1415927 for i in range(len(a)): a[i] = -a[i] if __name__ == '__main__': num = Value('d', 0.0) arr = Array('i', range(10)) p = Process(target=f, args=(num, arr)) p.start() p.join() print(num.value) print(arr[:]) I am trying to use