[Python-Dev] Updates to PEP 471, the os.scandir() proposal (original) (raw)
Ethan Furman ethan at stoneleaf.us
Thu Jul 10 01:26:01 CEST 2014
- Previous message: [Python-Dev] Updates to PEP 471, the os.scandir() proposal
- Next message: [Python-Dev] Updates to PEP 471, the os.scandir() proposal
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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.isdir() Return True if this is a directory-type entry; may call os.lstat if the cache is empty. DirEntry.isfile() Return True if this is a file-type entry; may call os.lstat if the cache is empty. DirEntry.issymlink() 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 "isdir", et al, functions, but "stat" not a function?
Good point. Make stat a function as well.
--
Ethan
- Previous message: [Python-Dev] Updates to PEP 471, the os.scandir() proposal
- Next message: [Python-Dev] Updates to PEP 471, the os.scandir() proposal
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]