[Python-Dev] pathlib and issue 11406 (a directory iterator returning stat-like info)
benhoyt at gmail.com
Mon Nov 25 20:45:07 CET 2013
> OK, so I'm a Windows dev, but my understanding is that d_ino is useful
> to tell if two files are identical - hard links to the same physical
> file have the same d_ino value. I don't believe it's possible to do
> this on Windows at all.
> I've seen it used in tools like diff, to short-circuit doing the
> actual diff if you know from a stat that the 2 files are the same.
Okay, that helps -- thanks.
So the inode number is probably not all that useful in this context at
all. Because it doesn't come with the device, you don't know whether
it's unique (from the posixpath.samestat source, it looks like a
file's only unique if the inode and device numbers are equal).
So I think I'm going to drop .dirent entirely, and just expose the
d_type information via the is_* functions.
I'm not sure about is_socket(), is_fifo(), is_block_device(),
is_char_device(). I'm tempted to just leave them off, as I think
they'll basically never be used ... their stat counterparts are
exceedingly rare in the stdlib, so if you really want that, just use
More information about the Python-Dev