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

Ben Hoyt benhoyt at gmail.com
Sat Feb 14 21:32:07 CET 2015


> +1 we need to provide the inode (we shouldn't be throwing anything from the
> underlying directory entry away when possible). But...
>
> I think the "or None" semantics are a bad idea.  It'd be better for this to
> raise AttributeError on Windows so that someone can't write the most natural
> form of code assuming that inode is valid and have it appear to work on
> Windows when in fact it'd do the wrong thing.

+1 for inode support. I agree with the above -- it should either raise
AttributeError on Windows if it's not going to be set ... or it should
be more like Victor's original proposal where .inode() is a method
that calls stat on Windows. I don't have strong feelings.

-Ben


More information about the Python-Dev mailing list