[docs] [issue13237] subprocess docs should emphasise convenience functions

Ezio Melotti report at bugs.python.org
Fri Oct 21 17:23:02 CEST 2011


Ezio Melotti <ezio.melotti at gmail.com> added the comment:

>From a quick look it seems to me that only 
-   output = Popen(["mycmd", "myarg"], stdout=PIPE).communicate()[0]
+   output = check_output(["mycmd", "myarg"])

can be changed.
Most of the other example access attributes of the Popen objects, such as stdin/stdout. subprocess.call is already used in a few places.

Another thing that I wanted to fix for a while is the syntax highlight in these examples.  Using '# becomes' instead of '==>' solves the problem for most of the examples, except for the first two that use `...`.  Using two separate blocks is another option.  A table with two columns (before/after) might also work, but it's difficult to get it wide enough to contain both the examples side by side.

About moving the convenience functions first, I'm not sure it works too well.
"This module defines one class called Popen:"
could be replaced by
"This module defines a class called Popen, and the convenience functions call(), check_call(), and check_output():"
where the three functions and possibly 'convenience functions' link to to the part of the page where they are defined.

----------
type: behavior -> 

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13237>
_______________________________________


More information about the docs mailing list