Why no isexec, isread, iswrite, etc (was: I must be missing something obvious: os.path.isexecutable?)

Steve Lamb grey at despair.rpglink.com
Thu Jan 18 17:31:11 EST 2001


On Thu, 18 Jan 2001 21:49:32 -0000, Steve Lamb <grey at despair.rpglink.com>
wrote:
>    OK, after further digging on deja I found a thread between Fredrik Lundh
>and Lenny Self regarding using the os.stat() call with the stat macros.  Is
>there an easier way?

    OK, pardon the stream of thought thread here, but I have found my answer
to the Python equivalent of the Perl -x check.  Now for a fun question.  I see
that os.path has isdir, isfile, islink defined.  In fact my initial confusion
is that os.path didn't have isread, iswrite, isexec.  It seemed logical.

    then I foudn the above mentioned conversation with the macros from stat
coming into play.  So I dug into os.path.py, bounced into posixpath.py, and
see that isdir, isfile and islink use the stat macros.  So why not complete
the suite of tests possible from the stat macros and have read/write/exec
tests in there as well?

-- 
         Steve C. Lamb         | I'm your priest, I'm your shrink, I'm your
         ICQ: 5107343          | main connection to the switchboard of souls.
-------------------------------+---------------------------------------------



More information about the Python-list mailing list