Inquiry regarding the name of subprocess.Popen class
code at pizzashack.org
Tue Sep 2 17:39:09 CEST 2008
On Tue, Sep 02, 2008 at 01:57:26PM +0000, Marc 'BlackJack' Rintsch wrote:
> > I would argue that they don't represent processes at all; the object is
> > a set of files which connect the standard I/O streams of a subprocess to
> > its parent, and methods to operate on those files.
> And the process' ID, an attribute with the process' return code, a method
> to wait until the process is finished and file objects to communicate
> with the process.
The name popen is an abbreviation of "pipe open" -- the function, and
the class, open pipes to communicate with another process. What you
said is correct; however there are numerous other ways to open
subprocesses. The focus of popen is the communication aspect -- the
opening and control of the pipes -- not the subprocess. That's the
key difference between popen() and all the other methods of starting a
> > The C library's popen() function, on which this class is based,
> > provides a means to open a file and connect it to the standard steams
> > of a subprocess, making it more closely analogous to what the Popen
> > class does/provides. As such, "Popen" is a better name to describe
> > this object than "subprocess" would be.
> Is strongly disagree. The class provides an interface to start and
> communicate with a `Subprocess`. Instances stand for processes.
There's more than one way to look at it. You can disagree all you
like, but your interpretation disagrees with the historical intent of
> With your reasoning the `file` type should be called `open`.
In this case, the file is a pipe, and the 'p' in popen represents the
pipe. Unix, by and large, doesn't care that it's a pipe -- file I/O
is intended to work the same way regardless of whether it's a pipe, a
socket, a file on disk, a special device file, or any other file-like
object you can imagine. That's why I said "file" instead of "pipe" in
Note that in all of these links that talk about popen, the focus is on
opening pipes or file objects, not on subprocesses:
The Linux man page unfortunately copies (verbatim) the FreeBSD man
page, which gets it wrong. You can not open a process, but you can
definitely open a pipe.
Derek D. Martin
GPG Key ID: 0x81CFE75D
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 196 bytes
Desc: not available
More information about the Python-list