Steve Dower <steve.do...@python.org> added the comment:

Those are all good ideas, but using os.stat(d) instead of d.stat() is shorter, 
more reliable, more compatible, and already works.

There's no middle ground where DirEntry can be faster, because it's already 
using that middle ground. All the discussion between Eryk and myself was 
figuring out whether we can use the DirEntry/FindFileData information to tell 
whether the file needs an explicit stat() or not, and we can't.

Most of the performance impact of stat() is just in opening the file (which 
scandir() does not do). As soon as we have to directly access the file, we may 
as well get all the information from it. We're already getting all the "cheap" 
information we can.

----------
assignee:  -> docs@python
components: +Documentation
nosy: +docs@python
versions: +Python 3.10, Python 3.9 -Python 3.8

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue41106>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to