Gregory P. Smith added the comment: Here's is an os.scandir(path='.') implementation that iterates reading the directory on the fly instead of pre-building a list.
os.listdir's implementation should ultimately be replaced by this as: def listdir(path=None): if path is None: return list(os.scandir()) return list(os.scandir(path)) Though I have not yet done that in this patch so that I could compare behavior of old vs new. Why the scandir name? Read the libc scandir man page. It fits. I have tested this on POSIX (Linux). I don't have any ability to build Windows code so I expect that still has bugs and possibly compilation issues. Please leave comments on the 'review' link. ---------- keywords: +patch stage: -> patch review type: performance -> enhancement Added file: http://bugs.python.org/file29568/issue11406-gps01.diff _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue11406> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com