Why is the subprocess.Popen class not called Subprocess?

The primary class in the module subprocessis the name Popenand is a subprocess. Popenit sounds like someone was trying to get the name to follow some function naming format, instead of just naming the name, which is actually an object. Does anyone know why he was chosen over something simple, for example subprocess?

+3
source share
3 answers

Now I'm not saying that this is the greatest name in the world, but here is the idea, as I understand it.

The popen family was originally in the os module and was an implementation of the venerable posix popen. Going to the subprocess module would be a good time to rename them, but I believe that saving Popen makes it easy to search documents for those with a long history with python or even with respectable posix functions.

From its earliest incarnation, posix Popenhas always been intended to open the process and allows you to read and write from your stdio as a file. Thus, the mnemonics for Popenis that it is short for ProcessOpenin an attempt to kind, sorta, look like open.

+8
source

subprocess.Popen os.popenX POSIX ( ). , Popen , , .

PEP (PEP 324) , Popen. PEP ( Python), , , Python.

+5

I assume that the name was chosen because the replacement of the function subprocesswas previously in the module osas a function os.popen. There may even be ways to automate migration between them.

-1
source

Source: https://habr.com/ru/post/1696623/


All Articles