So you can't use it in interactive sessions:
In [1]: import multiprocessing
In [2]: pool = multiprocessing.Pool(8)
In [3]: def hello(x):
....: return x+1
....:
In [5]: stuff = range(10)
In [4]: pool.map(hello, stuff)
# cryptic errors
You also can't use it with lambdas or functions defined within functions; suppose I put this in test.py: import multiprocessing
def run_stuff():
pool = multiprocessing.Pool(8)
def hello(x):
return x+1
stuff = range(10)
return pool.map(hello, stuff)
print(run_stuff())
... I get the same errors.This is sad because pool.map seems to be faster than anything I have written myself which might replace it without the above limitations. Unless someone out there has done better than me? :)