[Python-Dev] Updates to PEP 471, the os.scandir() proposal
Ethan Furman
ethan at stoneleaf.us
Thu Jul 10 01:26:01 CEST 2014
On 07/09/2014 04:22 PM, MRAB wrote:
> On 2014-07-09 23:50, Ethan Furman wrote:
>>
>> Okay, marry the two ideas together:
>>
>> scandir(path, info=None, onerror=None)
>> """
>> Return a generator that returns one directory entry at a time in a DirEntry object
>
> Should that be "that yields one directory entry at a time"?
Yes, thanks.
>> info: None --> DirEntries will have whatever attributes the O/S provides
>> 'type' --> DirEntries will already have at least the file/dir distinction
>> 'stat' --> DirEntries will also already have stat information
>> """
>>
>> DirEntry.is_dir()
>> Return True if this is a directory-type entry; may call os.lstat if the cache is empty.
>>
>> DirEntry.is_file()
>> Return True if this is a file-type entry; may call os.lstat if the cache is empty.
>>
>> DirEntry.is_symlink()
>> Return True if this is a symbolic link; may call os.lstat if the cache is empty.
>>
>> DirEntry.stat
>> Return the stat info for this link; may call os.lstat if the cache is empty.
>
> Why is "is_dir", et al, functions, but "stat" not a function?
Good point. Make stat a function as well.
--
~Ethan~
More information about the Python-Dev
mailing list