[Python-Dev] slightly misleading Popen.poll() docs

Chris Withers chris at python.org
Wed Dec 5 17:40:40 CET 2012

On 05/12/2012 16:34, Antoine Pitrou wrote:
>> http://docs.python.org/3/library/subprocess.html#subprocess.Popen.poll
> The doc looks clear to me. poll() returns the returncode attribute which
> is described thusly:
> "A None value indicates that the process hasn’t terminated yet."
> Therefore, I don't understand the confusion.

Because lazy/busy people don't bother reading the links underneath docs...

> poll() is explicitly
> non-blocking, and it is silly to expect it to return a process return
> code when the process hasn't returned yet (!).  The correct answer is
> to use the wait() method (or communicate()), which is described two
> lines below poll().

I agree, however, I also:
- don't see any harm in the change I propose
- do see a slight improvement for the comprehending impaired ;-)

> May I suggest your colleagues didn't read the doc at all?

One of them quoted the docs at me at proof that his code must be correct ;-)


Simplistix - Content Management, Batch Processing & Python Consulting
             - http://www.simplistix.co.uk

More information about the Python-Dev mailing list