[Python-Dev] Updates to PEP 471, the os.scandir() proposal
benhoyt at gmail.com
Tue Jul 8 20:05:53 CEST 2014
> Only exposing what the OS provides for free will make the API too difficult
> to use in the common case. But is there a nice way to expand the API that
> will allow the user who is trying to avoid extra expense know what
> information is already available?
> Even if the initial version doesn't have a way to check what information is
> there for free, ensuring there is a clean way to add this in the future
> would be really nice.
We could easily add ".had_type" and ".had_lstat" properties (not sure
on the names), that would be true if the is_X information and lstat
information was fetched, respectively. Basically both would always be
True on Windows, but on POSIX only had_type would be True d_type is
present and != DT_UNKNOWN.
I don't feel this is actually necessary, but it's not hard to add.
More information about the Python-Dev