[Python-Dev] Updates to PEP 471, the os.scandir() proposal

Paul Moore p.f.moore at gmail.com
Wed Jul 9 09:13:10 CEST 2014


On 9 July 2014 02:08, Ben Hoyt <benhoyt at gmail.com> wrote:
> Comments and votes, please!

+1 on option 1 (current PEP approach) at the moment, but I would like
to see how the error handling would look (suppose the function logs
files that can't be statted, and assumes a size of 0 for them). The
idea of a multi-level ensure_lstat isn't unreasonable, either, and
that helps option 2.

The biggest issue *I* see with option 2 is that people won't remember
to add the ensure_XXX argument, and that will result in more code that
seems to work but fails cross-platform. Unless scandir deliberately
fails if you use an attribute that you haven't "ensured", but that
would be really unfriendly...

Paul


More information about the Python-Dev mailing list