[Python-Dev] Missing POSIX functions: the list
Greg Stein
gstein@lyra.org
Thu, 9 Dec 1999 16:32:33 -0800 (PST)
On Thu, 9 Dec 1999, Fred L. Drake, Jr. wrote:
> Andrew M. Kuchling writes:
>...
> > opendir(), readdir(), closedir() --
> > most of their functionality is available through
> > os.listdir(), but it might be useful to have a direct
> > interface. Downside is that this would require a new
> > extension type for the C DIR struct. My (lazy) inclination
> > is to not bother.
>
> [rewinddir() and seekdir() should be considered as well, where
> supported.]
>
> There's more tedium than anything in implementing a new C type. I'm
> a little concerned that there might not be any real value here, but
> it's hard to be sure about that. Is there any real reason not to use
> os.listdir().
No need to do a new type. Just wrap the DIR* into a PyCObject. Add a magic
number if you're worried about mixing CObjects.
Cheers,
-g
--
Greg Stein, http://www.lyra.org/