Inquiry regarding the name of subprocess.Popen class
Marc 'BlackJack' Rintsch
bj_666 at gmx.net
Tue Sep 2 18:55:54 EDT 2008
On Tue, 02 Sep 2008 18:15:07 -0400, Derek Martin wrote:
>> Classes represent "things", and class names should be nouns.
>
> Is that a law?
It's a common guideline.
> Classes are instantiated by invoking their class names as a function
> call -- the computing equivalent of a verb. Why then, must they be
> named as nouns? Can you not, in fact, have classes which describe (or
> model) actions? Wouldn't you name them using verbs if you did?
Me personally no. I would use `FooAction` instead of `Foo` or something
similar. And if they model an action there must be some way to activate
the action but the instances of `Popen` are no actions. There's no way
to "execute" a `Popen` instance.
> That said, this is the most valid point anyone has made... You should
> have made it when the module was being designed. :-D
>
> My point is, if you don't think Popen is a good name for the class,
> that's your opinion, but it is only that: an opinion.
Like your opinion that it *is* a good name.
> Yet some of you state your case as if it is incontrovertable fact.
> I've given a good case as to why it IS a good name (one which I
> genuinely support), and disagree as you may, none of the points any of
> you have made invalidate or even weaken my argument.
Maybe from your POV. Facts: It doesn't use the `popen()` function, it
gives something more complex than a simple pipe (no obligatory shell, up
to three file objects, more attributes and methods), the function used on
Windows under the hood is called `CreateProcess()` not `CreatePipe()`.
`Popen` creates a process and represents a proxy object to communicate
with it, so `Process` is a good name for that concept/"thing". It's a
way more self explaining name, even for people who know the `popen()`
function because there's a concept called "process" but none called
"popen".
Ciao,
Marc 'BlackJack' Rintsch
More information about the Python-list
mailing list