Anthony Flury <[email protected]> added the comment:
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.
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue34891>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com