Re: os.listdir unwanted behaviour

2009-09-29 Thread Tim Chase
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 vers

Re: os.listdir unwanted behaviour

2009-09-29 Thread Hendrik van Rooyen
On Tuesday, 29 September 2009 11:03:17 Tim Chase wrote: > I think Steven may be remembering the conversation here on c.l.p > 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

Re: os.listdir unwanted behaviour

2009-09-29 Thread Tim Chase
Piet van Oostrum wrote: Steven D'Aprano (SD) wrote: SD> What you describe is impossible -- os.listdir() returns an ordinary list, SD> it isn't a lazy iterator that updates automatically as the directory SD> changes. (At least not in Python2.5 -- I haven't checked Python 3.1.) He's not usi

Re: os.listdir unwanted behaviour

2009-09-29 Thread Piet van Oostrum
> Steven D'Aprano (SD) wrote: >SD> What you describe is impossible -- os.listdir() returns an ordinary list, >SD> it isn't a lazy iterator that updates automatically as the directory >SD> changes. (At least not in Python2.5 -- I haven't checked Python 3.1.) He's not using Python3, see the

Re: os.listdir unwanted behaviour

2009-09-29 Thread Steven D'Aprano
On Tue, 29 Sep 2009 16:03:46 +1000, Chris Adamson wrote: > Hello, > > I am writing code that cycles through files in a directory and for each > file it writes out another file with info in it. It appears that as I am > iterating through the list returned by os.listdir it is being updated > with t

Re: os.listdir unwanted behaviour

2009-09-29 Thread Peter Otten
Chris Adamson wrote: > I am writing code that cycles through files in a directory and for each > file it writes out another file with info in it. It appears that as I am > iterating through the list returned by os.listdir it is being updated > with the new files that are being added to the directo

Re: os.listdir unwanted behaviour

2009-09-28 Thread Chris Rebert
On Mon, Sep 28, 2009 at 11:03 PM, Chris Adamson wrote: > Hello, > > I am writing code that cycles through files in a directory and for each file > it writes out another file with info in it. It appears that as I am > iterating through the list returned by os.listdir it is being updated with > the

os.listdir unwanted behaviour

2009-09-28 Thread Chris Adamson
Hello, I am writing code that cycles through files in a directory and for each file it writes out another file with info in it. It appears that as I am iterating through the list returned by os.listdir it is being updated with the new files that are being added to the directory. This occurs e