[New-bugs-announce] [issue36771] Feature Request: An option to os.walk() to return os.DirEntry lists instead of just filenames/dirnames

CJ Kucera report at bugs.python.org
Wed May 1 11:20:07 EDT 2019


New submission from CJ Kucera <pez at apocalyptech.com>:

It'd be nice to have an option to os.walk which would return DirEntry objects in its return tuple, as opposed to just the string filenames/dirnames.  (Or failing that, an alternate function which does so.)  The function already uses os.scandir() internally, so the DirEntry objects already exist -- I assume it'd be a pretty easy change.  At the moment, if I want to be efficient and use os.scandir() myself, I've got to basically reimplement os.walk(), which seems silly since os.walk is already calling scandir itself.

----------
components: Library (Lib)
messages: 341210
nosy: apocalyptech
priority: normal
severity: normal
status: open
title: Feature Request: An option to os.walk() to return os.DirEntry lists instead of just filenames/dirnames
type: enhancement
versions: Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36771>
_______________________________________


More information about the New-bugs-announce mailing list