OSDir


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


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