Greg Stein writes:
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.
That's certainly one option, but I would have made readdir(), seekdir(), rewinddir() and closedir() into the methods read(), seek(), rewind() and close(). So it's a question of what interface you prefer; functions with magically interpreted token parameters (kind of like file descriptors, hey!), or something that is more recognizably object-oriented. I know my preference. ;-)
-Fred
-- Fred L. Drake, Jr. fdrake@acm.org Corporation for National Research Initiatives