[Python-ideas] PEP471 - (os.scandir())

Paul Moore p.f.moore at gmail.com
Fri Nov 27 13:34:45 EST 2015


On 27 November 2015 at 18:32, Paul Moore <p.f.moore at gmail.com> wrote:
> On 26 November 2015 at 23:22, Erik <python at lucidity.plus.com> wrote:
>> I have studied the PEP, followed a lot of the references and looked at the
>> 3.5.0 implementation. I can't see that I've missed such a thing already
>> existing, but it's possible. If so, perhaps this is instead a request to
>> make that thing more obvious somehow!
>
> Does pathlib use scandir? If so, then maybe you get the caching
> benefits by using pathlib? And if pathlib doesn't use scandir, maybe
> it should? [I just checked, it looks like pathlib doesn't use scandir
> :-(]

Never mind - see
https://www.python.org/dev/peps/pep-0471/#return-values-being-pathlib-path-objects
Pathlib objects must not cache the results of stat calls, so they
cannot use scandir.

Paul


More information about the Python-ideas mailing list