[Python-ideas] os.listdir iteration support

Adam Atlas adam at atlas.st
Fri Nov 23 06:54:48 CET 2007


On 22 Nov 2007, at 23:59, Aahz wrote:
> The problem is that reading a directory requires an open file handle;
> given a generator context, there's no clear mechanism for determining
> when to close the handle.

Whenever the generator is __del__ed, or whenever the iteration  
completes, whichever comes first?

> Because the list needs to be created in the first place

How so?




More information about the Python-ideas mailing list