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

Calvin Spealman cspealma at redhat.com
Wed Oct 24 09:34:34 EDT 2018


In the spirit of "There should be one-- and preferably only one --obvious
way to do it." this makes perfect sense.

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.

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

On Wed, Oct 24, 2018 at 7:58 AM Steve Dower <steve.dower at python.org> wrote:

> On 24Oct2018 0435, Antoine Pitrou wrote:
> > On Wed, 24 Oct 2018 08:05:21 +0200
> > Stephane Wirtel <stephane at wirtel.be> wrote:
> >> 1. Add the 'deprecated' directive in the doc
> >> 2. Use subprocess for these references
> >>
> >> What is your opinion?
> >
> > I don't think it's useful to deprecate something that works fine for
> > the intended purpose.
>
> Agreed.
>
> There are two different groups of users involved here. People developing
> scripts to run on their own machines (super-shell scripts, if you like),
> and people developing applications/libraries to run on other machines.
>
> The latter case should *definitely* be using subprocess, because they
> shouldn't be making assumptions about what shell is being used.
>
> The former case should be able to use os.system if that satisfies their
> needs, without seeing warnings that make them think they can't write the
> simplest code that works anymore.
>
> If that means changing *some* of the other references in the docs, then
> I'm okay with that. But both uses are valid, so it's really more about
> being clear who the function is intended for.
>
> Cheers,
> Steve
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe:
> https://mail.python.org/mailman/options/python-dev/cspealma%40redhat.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20181024/e645dd0a/attachment.html>


More information about the Python-Dev mailing list