[Python-Dev] PEP 471 (scandir): Add a new DirEntry.inode() method?

Victor Stinner victor.stinner at gmail.com
Sat Feb 14 11:57:15 CET 2015


Le samedi 14 février 2015, Stephen J. Turnbull <stephen at xemacs.org> a
écrit :
>
> IMO: Document the limitation (if no extra syscall) or inefficiency
> (with the syscall), and let the user choose.


 Hum, by the way, I don't know if we should dd the method on Windows. As I
said, I don't want to cache The result of the os.lstat(). Basically, there
is no benfit for  other methods to call inode().

 A method may be a trap for Windows users.

I propose something else: a DirEntry.inode read-only property which would
be None on Windows. So you see dirrectly that the property is for POSIX,
and that calling os.stat() is required on Windows. os.stat() not
DirEntry.stat(), DirEntry.stat() doesn't fill st_ino, st_dev and st_nlink
are not filled on Windows.

Victor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20150214/6a2c2c01/attachment.html>


More information about the Python-Dev mailing list