Inquiry regarding the name of subprocess.Popen class
gagsl-py2 at yahoo.com.ar
Tue Sep 2 22:22:51 CEST 2008
En Tue, 02 Sep 2008 12:39:09 -0300, Derek Martin <code at pizzashack.org> escribió:
> 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
Totally irrelevant here - we are talking about the subprocess module, not the popen C function.
>> > The C library's popen() function, on which this class is based,
No, subprocess.Popen does not use -directly or indirectly- the C popen function. It uses fork or CreateProcess in Windows.
> 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.
(Ok, if it doesn't agree with you, it must be wrong)
Classes represent "things", and class names should be nouns. Functions represent "actions", and their names should be verbs. popen is a good name for a function; Popen is a bad name for a class.
More information about the Python-list