Le Fri, 10 May 2013 23:53:37 +1000, Nick Coghlan <[email protected]> a écrit : > On Fri, May 10, 2013 at 11:46 PM, Christian Heimes > <[email protected]> wrote: > > Am 10.05.2013 14:16, schrieb Antoine Pitrou: > >> But what if some systems return more than the file type and less > >> than a full stat result? The general problem is POSIX's terrible > >> inertia. I feel that a stat result with some None fields would be > >> an acceptable compromise here. > > > > POSIX only defines the d_ino and d_name members of struct dirent. > > Linux, BSD and probably some other platforms also happen to provide > > d_type. The other members of struct dirent (d_reclen, d_namlen) > > aren't useful in Python space by themselves. > > > > d_type and st_mode aren't compatible in any way. As you know st_mode > > also contains POSIX permission information. The file type is encoded > > with a different set of bits, too. Future file types aren't mapped > > to S_IF* constants for st_mode. > > Why are we exposing a bitfield as the primary Python level API, > anyway? It makes sense for the well defined permission bits, but why > are we copying the C level concept for the other flags?
Precisely because they are not well-defined, hence any interpretation by us may be incorrect or incomplete (e.g. obscure system-specific bits). Regards Antoine. _______________________________________________ Python-Dev mailing list [email protected] http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
