[Python-3000] Removal of os.path.walk

Aahz aahz at pythoncraft.com
Wed Apr 30 16:48:04 CEST 2008


On Tue, Apr 29, 2008, Guido van Rossum wrote:
> On Tue, Apr 29, 2008 at 8:10 PM, Tim Heaney <theaney at gmail.com> wrote:
>>
>> Speaking of this, is it too late to lobby for an iterator version of
>>  os.listdir? (Perhaps listdir would not be the best name. :)
>>
>>  There is one at
>>
>>   http://wxidle.sourceforge.net/projects/xlistdir/
>>
>>  but I think it ought to be in the standard library. Moreover, if we
>>  had such a thing, shouldn't os.walk use it instead of lists?
> 
> I'm not sure I see the advantage of having it as an iterator; I doubt
> that there is ever not enough memory to hold the contents of a single
> directory. Do you have a compelling use case?

There's a big difference between "not enough memory" and "directory
consumes lots of memory".  My company has some directories with several
hundred thousand entries, so using an iterator would be appreciated
(although by the time we upgrade to Python 3.x, we probably will have
fixed that architecture).

But even then, we're talking tens of megabytes at worst, so it's not a
killer -- just painful.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

Help a hearing-impaired person: http://rule6.info/hearing.html


More information about the Python-3000 mailing list