[Python-Dev] deprecate commands.getstatus()

Guido van Rossum guido at python.org
Tue Mar 13 22:16:21 CET 2007


On 3/13/07, Georg Brandl <g.brandl at gmx.net> wrote:
> I'd like to deprecate commands.getstatus() in 2.6.
>
> Reason: there is getoutput() and getstatusoutput(). In the latter, "status"
> means the exit code. getstatus(), however, returns the output of "ls -ld
> <file>" which is completely nonobvious and confusing.

+1.

> Perhaps the whole commands module can be deprecated in favor of subprocess.

-1.

Reason (for both voteS): I have learned that the getoutput() and
getstatusoutput() functions in the commands module are exceedingly
popular amongst Googlers who write simple Python scripts that
occasionally invoke an external command. It's much simpler than using
os.popen() or the subprocess module (which is also very popular BTW).
But I have found no uses of commands.getstatus() in our entire
codebase so I'm okay with seeing that mistake finally eradicated (and
it was *my* mistake :-).

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-Dev mailing list