[Python-Dev] Issue 11406: adding os.scandir(), a directory iterator returning stat-like info

Nick Coghlan ncoghlan at gmail.com
Sat May 11 18:36:28 CEST 2013


On Sun, May 12, 2013 at 2:30 AM, Nick Coghlan <ncoghlan at gmail.com> wrote:
> Once that core functionality is in place, *then* start debating what
> other use cases to optimise based on which platforms would support
> those optimisations and which would require dropping back to the full
> stat implementation anyway.

Alternatively, we could simply have a full "dirent" attribute that is
None on Windows. That would actually make sense at an implementation
level anyway - is_file() etc would check self.cached_lstat first, and
if that was None they would check self.dirent, and if that was also
None they would raise an error.

Construction of a dir_entry would require either a stat object or a
dirent object, but complain if it received both.

Cheers,
Nick.

--
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia


More information about the Python-Dev mailing list