|  | Inquiry regarding the name of subprocess.Popen class |  | |
| | | Jeremy Banks |  |
| Posted: Mon Sep 01, 2008 5:23 am Post subject: Inquiry regarding the name of subprocess.Popen class |  |
Hi. I wondered if anyone knew the rationale behind the naming of the Popen class in the subprocess module. Popen sounds like the a suitable name for a function that created a subprocess, but the object itself is a subprocess, not a "popen". It seems that it would be more accurate to just name the class Subprocess, can anyone explain why this is not the case?
Thank you. |
| |
| | | Gabriel Genellina |  |
| Posted: Tue Sep 02, 2008 6:36 am Post subject: Re: Inquiry regarding the name of subprocess.Popen class |  |
En Mon, 01 Sep 2008 04:23:38 -0300, Jeremy Banks <jeremy@jeremybanks.ca> escribió:
| Quote: | Hi. I wondered if anyone knew the rationale behind the naming of the Popen class in the subprocess module. Popen sounds like the a suitable name for a function that created a subprocess, but the object itself is a subprocess, not a "popen". It seems that it would be more accurate to just name the class Subprocess, can anyone explain why this is not the case?
|
I have no idea - but I agree, Subprocess would have been a better name.
-- Gabriel Genellina |
| |
| | | Gabriel Genellina |  |
| Posted: Tue Sep 02, 2008 6:36 am Post subject: Re: Inquiry regarding the name of subprocess.Popen class |  |
En Mon, 01 Sep 2008 04:23:38 -0300, Jeremy Banks <jeremy@jeremybanks.ca> escribió:
| Quote: | Hi. I wondered if anyone knew the rationale behind the naming of the Popen class in the subprocess module. Popen sounds like the a suitable name for a function that created a subprocess, but the object itself is a subprocess, not a "popen". It seems that it would be more accurate to just name the class Subprocess, can anyone explain why this is not the case?
|
I have no idea - but I agree, Subprocess would have been a better name.
-- Gabriel Genellina |
| |
| | | Marc 'BlackJack' Rintsch |  |
| Posted: Tue Sep 02, 2008 10:27 am Post subject: Re: Inquiry regarding the name of subprocess.Popen class |  |
On Tue, 02 Sep 2008 05:02:07 -0700, Nicola Musatti wrote:
| Quote: | On Sep 1, 9:23 am, Jeremy Banks <jer...@jeremybanks.ca> wrote: Hi. I wondered if anyone knew the rationale behind the naming of the Popen class in the subprocess module. Popen sounds like the a suitable name for a function that created a subprocess, but the object itself is a subprocess, not a "popen". It seems that it would be more accurate to just name the class Subprocess, can anyone explain why this is not the case?
The Python class is a generalization of the standard Posix function of (almost) the same name: LINK
|
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.
Ciao, Marc 'BlackJack' Rintsch |
| |
| | | Derek Martin |  |
| Posted: Tue Sep 02, 2008 11:28 am Post subject: Re: Inquiry regarding the name of subprocess.Popen class |  |
On Tue, Sep 02, 2008 at 12:27:49PM +0000, Marc 'BlackJack' Rintsch wrote:
| Quote: | The Python class is a generalization of the standard Posix function of (almost) the same name: LINK
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. 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.
-- Derek D. Martin LINK GPG Key ID: 0x81CFE75D |
| |
| | | Marc 'BlackJack' Rintsch |  |
| Posted: Tue Sep 02, 2008 11:57 am Post subject: Re: Inquiry regarding the name of subprocess.Popen class |  |
| |  | |
On Tue, 02 Sep 2008 09:28:42 -0400, Derek Martin wrote:
| Quote: | 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: LINK
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.
| Quote: | 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 |
| |
| | | Nicola Musatti |  |
| Posted: Tue Sep 02, 2008 12:02 pm Post subject: Re: Inquiry regarding the name of subprocess.Popen class |  |
On Sep 1, 9:23 am, Jeremy Banks <jer...@jeremybanks.ca> wrote:
| Quote: | Hi. I wondered if anyone knew the rationale behind the naming of the Popen class in the subprocess module. Popen sounds like the a suitable name for a function that created a subprocess, but the object itself is a subprocess, not a "popen". It seems that it would be more accurate to just name the class Subprocess, can anyone explain why this is not the case?
|
The Python class is a generalization of the standard Posix function of (almost) the same name: LINK
Cheers, Nicola Musatti |
| |
| | | Derek Martin |  |
| Posted: Tue Sep 02, 2008 1:39 pm Post subject: Re: Inquiry regarding the name of subprocess.Popen class |  |
| |  | |
On Tue, Sep 02, 2008 at 01:57:26PM +0000, Marc 'BlackJack' Rintsch wrote:
| Quote: | 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 subprocess.
| Quote: | 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.
| Quote: | 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 my explanation.
Note that in all of these links that talk about popen, the focus is on opening pipes or file objects, not on subprocesses:
LINK LINK LINK LINK LINK
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 LINK GPG Key ID: 0x81CFE75D |
| |
| | | Marc 'BlackJack' Rintsch |  |
| Posted: Tue Sep 02, 2008 4:47 pm Post subject: Re: Inquiry regarding the name of subprocess.Popen class |  |
| |  | |
On Tue, 02 Sep 2008 11:39:09 -0400, Derek Martin wrote:
| Quote: | 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 subprocess.
|
But I'm not talking about the `popen()` function but the `subprocess.Popen` class.
| Quote: | 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.
| Quote: | Note that in all of these links that talk about popen, the focus is on opening pipes or file objects, not on subprocesses:
LINK LINK LINK LINK LINK
|
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.
| Quote: | 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 wrong. ;-)
Ciao, Marc 'BlackJack' Rintsch |
| |
| | | Gabriel Genellina |  |
| Posted: Tue Sep 02, 2008 6:22 pm Post subject: Re: Inquiry regarding the name of subprocess.Popen class |  |
| |  | |
En Tue, 02 Sep 2008 12:39:09 -0300, Derek Martin <code@pizzashack.org> escribió:
| Quote: | 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 subprocess.
|
Totally irrelevant here - we are talking about the subprocess module, not the popen C function.
| Quote: | 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.
| Quote: | Note that in all of these links that talk about popen, the focus is on opening pipes or file objects, not on subprocesses:
LINK LINK LINK LINK LINK
|
Again, irrelevant.
| Quote: | 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.
-- Gabriel Genellina |
| |
| Page 1 of 3 .:. Goto page 1, 2, 3 Next | |
|
|