[Python-Dev] marking os.system() as deprecated in the docs

Chris Rebert pydev at rebertia.com
Tue Jul 27 01:16:31 CEST 2010


> On Sun, Jul 25, 2010 at 11:42 PM, Chris Rebert <pydev at rebertia.com> wrote:
>> Hello,
>>
>> I'd like to propose formally marking os.system() as deprecated in the
>> docs for next release of Python (v3.2 ?).
>>
>> The docs for os.system() /already/ include the following paragraph,
>> which is basically tantamount to calling system() deprecated and very
>> much resembles the deprecation notes for the os.popen*() family.
>> """
>> The subprocess module provides more powerful facilities for spawning
>> new processes and retrieving their results; using that module is
>> preferable to using this function. Use the subprocess module. Check
>> especially the Replacing Older Functions with the subprocess Module
>> section.
>> """

Emphasizing the following paragraph from my original email:

>> I'm merely suggesting slapping a formal ".. deprecated::" tag & box
>> around this paragraph to make system()'s status more obvious. I am
>> ***not*** suggesting the function be scheduled for removal or anything
>> like that.
>>
>> I figure since this would be a substantive change (the docs currently
>> don't outright say "deprecated"), it would need dev approval, hence
>> this message. I've already written the absolutely /trivial/ docs
>> patch.
>>
>> So, any objections?

On Mon, Jul 26, 2010 at 7:29 AM, Guido van Rossum <guido at python.org> wrote:
> Unless, it's as simple as replacing "os.system(x)" with
> "subprocess.system(x)", I'm against this removal of a handy shorthand.

[Addressing Steven's reply as well]

In hindsight, I should have used a word other than "deprecate"
(despite no longer matching the Sphinx directive) that's not
overloaded with Python baggage about removal; I intended it here in
its plain English meaning of merely "to express disapproval of" or "to
play down".

Allow me to reiterate: I am *NOT* suggesting os.system() be removed or
prepared for removal. I'm only suggesting the docs be /slightly/
tweaked to make it /slightly/ more obvious that os.system() is
dispreferred over the subprocess module. Removing os.system() would
have backward compatibility and cross-language API problems; I agree
it would be a bad idea; which is why I'm not proposing that.

> Ditto for popen.

Funny you should bring up os.popen(). Its docs are currently MIA in
3.x, for unclear reasons:
http://bugs.python.org/issue9382

Cheers,
Chris

> --
> --Guido van Rossum (python.org/~guido)


More information about the Python-Dev mailing list