views:

351

answers:

3

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?

A: 

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.

Sergio Acosta
+4  A: 

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.

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.

dF
+5  A: 

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.

From it's earliest posix incarnation, Popen has always been meant to open a Process and allow you to read and write from it's stdio like a file. Thus the mnemonic for Popen is that it is short for ProccesOpen in an attempt to kind of, sorta, look like open.

AmanKow