The primary class in the subprocess
module is name Popen
, and represents a subprocess. Popen
sounds like someone was trying to force the name to follow some function naming format, rather than chosing a name that actually represents what the object is. Does anyone know why it was chosen over something simple like, say, Subprocess
?
子进程模块中的主要类是名称Popen,表示子进程。 Popen听起来像有人试图强制名称遵循一些函数命名格式,而不是选择一个实际代表对象的名称。有谁知道为什么选择简单的东西,比如Subprocess?
3 个解决方案
#1
8
Now, I'm not saying that this is the greatest name in the world, but here was the idea as I understand it.
现在,我不是说这是世界上最伟大的名字,但这是我理解的想法。
Originally, the popen family was in the os module and was an implementation of the venerable posix popen. The movement to the subprocess module would have been an opportune time to rename them, but I guess that keeping Popen makes it easier to find in the docs for those who have a long history with python or even to the venerable posix functions.
最初,popen家族是在os模块中,并且是一个古老的posix popen的实现。移动到子进程模块将是重命名它们的合适时机,但我想保持Popen可以更容易地在文档中找到那些与python有着悠久历史甚至是古老的posix函数的人。
From its earliest posix incarnation, Popen
has always been meant to open a Process and allow you to read and write from its stdio like a file. Thus the mnemonic for Popen
is that it is short for ProcessOpen
in an attempt to kind of, sorta, look like open.
从最早的posix化身开始,Popen一直打算开启一个进程,让你可以像文件一样从它的stdio中读写。因此,Popen的助记符就是它是ProcessOpen的缩写,试图将它看起来像开放式。
#2
5
subprocess.Popen
replaces the group of os.popenX
POSIX functions (which have a long history). I suppose that the name Popen
makes it more likely for people used to the old functions to find and use the new ones.
subprocess.Popen替换os.popenX POSIX函数组(历史悠久)。我认为Popen的名字使得习惯旧功能的人更有可能找到并使用新功能。
The PEP for subprocess (PEP 324) has a little bit of discussion on the name of the module but not of class Popen
. The list of PEPs (Python enhancement proposals) is in general an excellent place to start if you're looking for the rationale for features of Python.
子进程的PEP(PEP 324)对模块的名称有一点讨论,但对Popen类没有讨论。如果您正在寻找Python功能的基本原理,那么PEP列表(Python增强建议)通常是一个很好的起点。
#3
-1
I suppose the name was chosen because the functionality subprocess
is replacing was formerly in the os
module as the os.popen
function. There could be even ways to automate migration between the two.
我想选择名称是因为功能子进程正在替换以前在os模块中作为os.popen函数。甚至可能有两种方法可以自动化两者之间的迁移。
#1
8
Now, I'm not saying that this is the greatest name in the world, but here was the idea as I understand it.
现在,我不是说这是世界上最伟大的名字,但这是我理解的想法。
Originally, the popen family was in the os module and was an implementation of the venerable posix popen. The movement to the subprocess module would have been an opportune time to rename them, but I guess that keeping Popen makes it easier to find in the docs for those who have a long history with python or even to the venerable posix functions.
最初,popen家族是在os模块中,并且是一个古老的posix popen的实现。移动到子进程模块将是重命名它们的合适时机,但我想保持Popen可以更容易地在文档中找到那些与python有着悠久历史甚至是古老的posix函数的人。
From its earliest posix incarnation, Popen
has always been meant to open a Process and allow you to read and write from its stdio like a file. Thus the mnemonic for Popen
is that it is short for ProcessOpen
in an attempt to kind of, sorta, look like open.
从最早的posix化身开始,Popen一直打算开启一个进程,让你可以像文件一样从它的stdio中读写。因此,Popen的助记符就是它是ProcessOpen的缩写,试图将它看起来像开放式。
#2
5
subprocess.Popen
replaces the group of os.popenX
POSIX functions (which have a long history). I suppose that the name Popen
makes it more likely for people used to the old functions to find and use the new ones.
subprocess.Popen替换os.popenX POSIX函数组(历史悠久)。我认为Popen的名字使得习惯旧功能的人更有可能找到并使用新功能。
The PEP for subprocess (PEP 324) has a little bit of discussion on the name of the module but not of class Popen
. The list of PEPs (Python enhancement proposals) is in general an excellent place to start if you're looking for the rationale for features of Python.
子进程的PEP(PEP 324)对模块的名称有一点讨论,但对Popen类没有讨论。如果您正在寻找Python功能的基本原理,那么PEP列表(Python增强建议)通常是一个很好的起点。
#3
-1
I suppose the name was chosen because the functionality subprocess
is replacing was formerly in the os
module as the os.popen
function. There could be even ways to automate migration between the two.
我想选择名称是因为功能子进程正在替换以前在os模块中作为os.popen函数。甚至可能有两种方法可以自动化两者之间的迁移。