Message327238
An example that does work :
$ python3
Python 3.6.6 (default, Sep 12 2018, 18:26:19)
[GCC 8.0.1 20180414 (experimental) [trunk revision 259383]] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from multiprocessing import Pool
>>> def f(x):
... return x**2
...
>>> with Pool(10) as p:
... print(p.map(f, range(1,10)))
[1, 4, 9, 16, 25, 36, 49, 64, 81]
So something about having Pool as a context manager means it works - very odd then.
BTW - with the exception of the example saying 'don't do this it doesn't work', none of the examples on the page are shown on the command line interpreter; but the first example uses a Pool context manager - which works as above. |
|
Date |
User |
Action |
Args |
2018-10-06 09:05:47 | anthony-flury | set | recipients:
+ anthony-flury, docs@python, xtreak |
2018-10-06 09:05:47 | anthony-flury | set | messageid: <1538816747.49.0.545547206417.issue34891@psf.upfronthosting.co.za> |
2018-10-06 09:05:47 | anthony-flury | link | issue34891 messages |
2018-10-06 09:05:47 | anthony-flury | create | |
|