[Python-Dev] PEP 471 -- os.scandir() function -- a better and faster directory iterator
ethan at stoneleaf.us
Tue Jul 1 01:45:18 CEST 2014
On 06/30/2014 04:15 PM, Tim Delaney wrote:
> On 1 July 2014 08:38, Ethan Furman wrote:
>> On 06/30/2014 03:07 PM, Tim Delaney wrote:
>>> I'm torn between whether I'd prefer the stat fields to be populated
>>> on Windows if ensure_lstat=False or not. There are good arguments each
>>> way, but overall I'm inclining towards having it consistent with POSIX
>>> - don't populate them unless ensure_lstat=True.
>>> +0 for stat fields to be None on all platforms unless ensure_lstat=True.
>> If a Windows user just needs the free info, why should s/he have to pay
>> the price of a full stat call? I see no reason to hold the Windows side
>> back and not take advantage of what it has available. There are plenty
>> of posix calls that Windows is not able to use, after all.
> On Windows ensure_lstat would either be either a NOP (if the fields are
> always populated), or it simply determines if the fields get populated.
> No extra stat call.
I suppose the exact behavior is still under discussion, as there are only two or three fields one gets "for free" on
Windows (I think...), where as an os.stat call would get everything available for the platform.
> On POSIX it's the difference between an extra stat call or not.
Agreed on this part.
Still, no reason to slow down the Windows side by throwing away info unnecessarily -- that's why this PEP exists, after all.
More information about the Python-Dev