[Python-Dev] "Deprecation" of os.system in favor of subprocess?

Steve Dower steve.dower at python.org
Wed Oct 24 10:42:28 EDT 2018

On 24Oct2018 0934, Calvin Spealman wrote:
> In the spirit of "There should be one-- and preferably only one 
> --obvious way to do it." this makes perfect sense.

To do what? There is one obvious way to run a system command, and one 
obvious way to manage subprocesses. There are also many non-obvious ways 
to run system commands, and many non-obvious ways to manage subprocesses.

> The distinction between "your own machine and other peoples machines" is 
> not always clear, nor planned for, nor understood by developers to be an 
> important distinction to make up-front. So the encouragement should be 
> clear.

Agreed. One good heuristic is whether you're putting the system command 
in a function or not, since functions are explicitly designing for reuse 
while just using it in a script is not.

> Simply put, there is no valid use case for os.system over subprocess by 
> remaining it must be considered redundant.

You have not shown this. Posting quotes followed by an unrelated 
conclusion isn't a very compelling form of argument :)


More information about the Python-Dev mailing list