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

Gregory P. Smith greg at krypto.org
Sat Feb 14 22:11:25 CET 2015


That suggests the .inode() method approach makes more sense then.

On Sat, Feb 14, 2015, 12:44 PM Antoine Pitrou <solipsis at pitrou.net> wrote:

> On Sat, 14 Feb 2015 15:32:07 -0500
> Ben Hoyt <benhoyt at gmail.com> wrote:
> > > +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.
>
> The whole point of scandir is to expose low-level system calls in a
> cross-platform way. If you start raising some exceptions on some
> platforms then that quality disappears.
>
> Regards
>
> Antoine.
>
>
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: https://mail.python.org/mailman/options/python-dev/
> greg%40krypto.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20150214/82695ebb/attachment.html>


More information about the Python-Dev mailing list