[docs] [issue34891] Multi-processing example inaccurate warning

Anthony Flury report at bugs.python.org
Sat Oct 6 05:05:47 EDT 2018


Anthony Flury <anthony.flury at btinternet.com> 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 <report at bugs.python.org>
<https://bugs.python.org/issue34891>
_______________________________________


More information about the docs mailing list