Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is the subprocess.Popen class not named Subprocess? [closed]

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?

like image 754
Jeremy Avatar asked Dec 17 '22 10:12

Jeremy


1 Answers

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 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.

like image 93
Wayne Werner Avatar answered Jan 05 '23 15:01

Wayne Werner