classification
Title: Documentation improvement proposal for multiprocessing
Type: Stage:
Components: Documentation Versions: Python 3.8
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: docs@python Nosy List: bombs-kim, docs@python, xtreak
Priority: normal Keywords:

Created on 2018-05-17 07:15 by bombs-kim, last changed 2018-09-23 16:01 by xtreak.

Messages (2)
msg316892 - (view) Author: bombs (bombs-kim) * Date: 2018-05-17 07:15
>>> 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?
msg316893 - (view) Author: bombs (bombs-kim) * Date: 2018-05-17 07:17
https://docs.python.org/3.8/library/multiprocessing.html#multiprocessing-programming

here is the link to the document.
History
Date User Action Args
2018-09-23 16:01:54xtreaksetnosy: + xtreak
2018-05-17 07:17:49bombs-kimsetmessages: + msg316893
2018-05-17 07:16:56bombs-kimsettitle: possible documentation improvement proposal for multiprocessing -> Documentation improvement proposal for multiprocessing
2018-05-17 07:15:18bombs-kimcreate