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 objectShould 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~ _______________________________________________ Python-Dev mailing list [email protected] https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
