Python multiprocessing: object passed by value?

前端 未结 2 719
广开言路
广开言路 2020-12-21 10:45

I have been trying the following:

from multiprocessing import Pool

def f(some_list):
    some_list.append(4)
    print \'Child process: new list = \' + str(         


        
2条回答
  •  别那么骄傲
    2020-12-21 11:28

    The multiprocessing library serializes objects using pickle to pass them between processes.

    This ensures safe inter-process communication, and two processes can use the "same" objects without using shared memory.

提交回复
热议问题