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

Antoine Pitrou solipsis at pitrou.net
Wed Dec 5 17:34:29 CET 2012


Le Wed, 05 Dec 2012 16:08:46 +0000,
Chris Withers <chris at simplistix.co.uk> a écrit :
> Hi All,
> 
> Would anyone object to me making a change to the docs for 2.6, 2.7
> and 3.x to clarify the following:
> 
> 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.  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().

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

Regards

Antoine.




More information about the Python-Dev mailing list