[Python-ideas] Extend the os.stat() result objects with methods like isfile() and isdir()

Christian Heimes christian at python.org
Fri May 3 14:27:08 CEST 2013


Am 03.05.2013 14:12, schrieb Ronald Oussoren:
> There also exist macros S_TYPEISMQ, S_TYPEISSEM, S_TYPEISSHM and S_TYPEISTMO, those have a struct stat as the argument and return if it refers to a message queue, semaphore, shared memory segment or typed memory (see http://pubs.opengroup.org/onlinepubs/009604599/basedefs/sys/stat.h.html). 
> 
> It don't know if there a systems where these macros can return a value other than 0 (both OSX and Linux always "return" 0 from these macros).

I've checked stat.h on some additional machines. Solaris 11 and AIX 7
have the macros but they always evaluates to 0. FreeBSD doesn't have the
macros at all. I could not find typed memory object macros on any system.

I guess we can safely ignore the files types as they aren't available on
any supported platform.

Christian




More information about the Python-ideas mailing list