a month or two back where folks were asking to turn os.listdir()
into an iterator (or create an os.xlistdir() or os.iterdir()
function) because directories with lots of files were causing
inordinate slowdown.  Yes, listdir() in both 2.x and 3.x both
return lists while such a proposed iterator version could be
changed on the fly by interim file/directory creation.

Is os.walk not the right thing to use for this kind of stuff?

Behind the scenes os.walk() calls listdir() which has the same problems in directories with large files. But yes, I believe there was discussion in that thread of having a generator that behaved like os.walk() but called the proposed xlistdir() or iterdir() function instead. However, no such beast exists yet (in stock Python).

-tkc




--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to