[issue34891] Multi-processing example inaccurate warning

2018-10-06 Thread Anthony Flury


Anthony Flury  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 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34891] Multi-processing example inaccurate warning

2018-10-04 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Thanks for the report. Are you referring to the below warning?

> Functionality within this package requires that the __main__ module be 
> importable by the children. This is covered in Programming guidelines however 
> it is worth pointing out here. This means that some examples, such as the 
> multiprocessing.pool.Pool examples will not work in the interactive 
> interpreter. For example:

I tried the example and it throws the AttributeError as shown in the example in 
Linux and MacOS. Maybe I am wrong on the above. Can you please add in the 
specific example that is shown as not executable from the interpreter but 
actually works?

Thanks

--
nosy: +xtreak

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34891] Multi-processing example inaccurate warning

2018-10-04 Thread Anthony Flury


New submission from Anthony Flury :

On the Multi-processing page 
 (just above the 
reference section) there is a warning that the examples wont work from the 
interpreter.

This is not entirely accurate in that the examples do work, in the interpreter 
within Linux (and Mac OS I think), where the O/S supports processes being 
forked.

In fact it is only in Windows, where a brand new process needs to be started 
and the source is effectively re-imported is there an issue running the 
examples in the interpreter.

Should the documentation make this clearer ?

--
assignee: docs@python
components: Documentation
messages: 327046
nosy: anthony-flury, docs@python
priority: normal
severity: normal
status: open
title: Multi-processing example inaccurate warning
versions: Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com