Inquiry regarding the name of subprocess.Popen class
Marc 'BlackJack' Rintsch
bj_666 at gmx.net
Tue Sep 2 20:47:39 CEST 2008
On Tue, 02 Sep 2008 11:39:09 -0400, Derek Martin wrote:
> On Tue, Sep 02, 2008 at 01:57:26PM +0000, Marc 'BlackJack' Rintsch
>> > 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
But I'm not talking about the `popen()` function but the
>> > 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 popen.
That's why I think the name `Popen` is not so good for it. Because it
does more than `popen()` and if it is called `Subprocess` or just
`Process` then it would be merely an implementation detail, that the
`popen()` function is called at some point. If it is at all, because
`popen()` on C level can just open a pipe in *one* direction.
> Note that in all of these links that talk about popen, the focus is on
> opening pipes or file objects, not on subprocesses:
> http://docs.python.org/lib/os-newstreams.html http://us3.php.net/popen
And all of the links talk about the `popen()` function, not about the
functionality the `Popen` class provides. Which is much more than that
simple pipe `popen()` returns.
> 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.
Ah, when their terminology doesn't match yours, they must get it
Marc 'BlackJack' Rintsch
More information about the Python-list