Author vstinner
Recipients benhoyt, brett.cannon, moloney, python-dev, vstinner
Date 2016-08-13.06:29:53
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <CAMpsgwZw+ykWn66bx7SMDjZYt-ve0AmvQ+wDP5ouGbc11Hc_jw@mail.gmail.com>
In-reply-to <1471047596.03.0.457132341618.issue27038@psf.upfronthosting.co.za>
Content
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.
History
Date User Action Args
2016-08-13 06:29:54vstinnersetrecipients: + vstinner, brett.cannon, benhoyt, python-dev, moloney
2016-08-13 06:29:53vstinnerlinkissue27038 messages
2016-08-13 06:29:53vstinnercreate