Issue 33553: Documentation improvement proposal for multiprocessing (original) (raw)

from multiprocessing import Pool p = Pool(5) def f(x): ... return x*x ... p.map(f, [1,2,3])

This example in the document is confusing because this is already wrong code when run with fork method even if you run it as a script. With fork start method, f should be defined before p is created.

Also, just advising that one shouldn't use interactive shell and should run multiprocessing code in if name == 'main' is not informative becuase those conditions are generally no problem with fork method.

Can I try improving the documentation?