STINNER Victor added the comment:

Brendan Moloney added the comment:
> It would be nice if there was a supported way to create a DirEntry object
from a path. If you don't want to document the constructor perhaps expose
some helper function or class method (i.e. from_path)?

It's a deliberate choice to not expose the constructor. You should not
built such objzct yourself. It requires low-level data coming from
readdir() or FindFirstFile(). If you don't pass such data, you loose the
whole purpose of the optimization.

Maybe the DirEntry doc must be more explicit on that point?

Please use pathlib instead. pathlib objects don't cache os.stat() result,
but that's also deliberate! It was proposed to add an optional cache, but
the idea was not accepted.

----------

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

Reply via email to