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

Michael Hudson mwh21 at cam.ac.uk
Thu Jan 18 19:43:07 EST 2001


grey at despair.rpglink.com (Steve Lamb) writes:

> 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?

http://www.python.org/patches

(sounds like a good idea to me, though I'd never use them, so I'm not
going to write the patch).

Cheers,
M.

-- 
  I never realized it before, but having looked that over I'm certain
  I'd rather have my eyes burned out by zombies with flaming dung
  sticks than work on a conscientious Unicode regex engine.
                                             -- Tim Peters, 3 Dec 1998



More information about the Python-list mailing list