[Python-Dev] Of what use is commands.getstatus()

Skip Montanaro skip@pobox.com
Thu, 22 May 2003 11:35:47 -0500


I was reading the docs for the commands module and noticed getstatus() seems
to be completely unrelated to getstatusoutput() and getoutput().  I thought,
"I'll correct the docs.  They must be wrong."  Then I looked at commands.py
and saw the docs are correct.  It's the function definition which is weird.
Of what use is it to return 'ls -ld file'?  Based on its name I would have
guessed its function was

    def getoutput(cmd):
        """Return status of executing cmd in a shell."""
        return getstatusoutput(cmd)[0]

This particular function dates from 1990, so it clearly can't just be
deleted, but it seems completely superfluous to me, especially given the
existence of os.stat, os.listdir, etc.  Should it be deprecated or modified
to do (what I think is) the obvious thing?

Skip