New submission from Aviv Palivoda: I am suggesting that os.walk and os.fwalk will yield a namedtuple instead of the regular tuple they currently yield. The use case for this change can be seen in the next example:
def walk_wrapper(walk_it): for dir_entry in walk_it: if dir_entry[0] == "aaa": yield dir_entry Because walk_it can be either os.walk or os.fwalk I need to access dir_entry via index. My change will allow me to change this function to: def walk_wrapper(walk_it): for dir_entry in walk_it: if dir_entry.dirpath == "aaa": yield dir_entry Witch is more clear and readable. ---------- components: Library (Lib) files: os-walk-result-namedtuple.patch keywords: patch messages: 264285 nosy: loewis, palaviv priority: normal severity: normal status: open title: os.walk and os.fwalk yield namedtuple instead of tuple type: enhancement versions: Python 3.6 Added file: http://bugs.python.org/file42612/os-walk-result-namedtuple.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26860> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com