From: Csaba H. <csa...@cr...> - 2006-05-25 17:08:15
|
On 2006-05-25, Rob Bradford <ro...@de...> wrote: > On Tue, May 23, 2006 at 05:57:35AM +0000, Csaba Henk wrote: >> Instead of hacking the traditional indexes of a Python stat tuple, I'd >> suggest keeping the st_rdev value at the end of the tuple (at index 10, >> with zero-based indexing) and leaving the rest intact. > > This was intentional. Since the order of the arguments follows the struct stat > structure I thought it best to continue to follow that. Well so, then we have a C system iterface vs. Python conventions conflict. I'd still go for pleasing the latter... we are in it for Python. Cf. http://docs.python.org/lib/os-file-dir.html stat(path) Perform a stat() system call on the given path. The return value is an object whose attributes correspond to the members of the stat structure, namely: st_mode ... st_ctime ... . ... On some Unix systems (such as Linux), the following attributes may also be available: st_blocks (number of blocks allocated for file), st_blksize (filesystem blocksize), st_rdev (type of device if an inode device). ... For backward compatibility, the return value of stat() is also accessible as a tuple of at least 10 integers giving the most important (and portable) members of the stat structure, in the order st_mode, st_ino, st_dev, st_nlink, st_uid, st_gid, st_size, st_atime, st_mtime, st_ctime. More items may be added at the end by some implementations. -- From which I concur: - st_rdev is system specific, therefore you can't just say "it's at the n-th position". - designers of Python also vote for leaving the 10 standard fields as-is, and append the rest in a non specified way. Regards, Csaba |