Inquiry regarding the name of subprocess.Popen class

Marc 'BlackJack' Rintsch bj_666 at gmx.net
Tue Sep 2 09:57:26 EDT 2008


On Tue, 02 Sep 2008 09:28:42 -0400, Derek Martin wrote:

> On Tue, Sep 02, 2008 at 12:27:49PM +0000, Marc 'BlackJack' Rintsch
> wrote:
>> > The Python class is a generalization of the standard Posix function
>> > of (almost) the same name:
>> > http://opengroup.org/onlinepubs/007908775/xsh/popen.html
>> 
>> So it's a name of a *function* and it's a little bit unsuitable for a
>> *class*.  As Jeremy wrote: the instances represent *processes* not
>> "popen"s, whatever that may be.
> 
> 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 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.

With your reasoning the `file` type should be called `open`.

Ciao,
	Marc 'BlackJack' Rintsch



More information about the Python-list mailing list