os.listdir unwanted behaviour

Piet van Oostrum piet at cs.uu.nl
Tue Sep 29 10:00:11 CEST 2009

>>>>> Steven D'Aprano <steven at REMOVE.THIS.cybersource.com.au> (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 print statement and the file function.
But even with the appropriate changes the behaviour will be the same in
3.1 as in 2.x.
Piet van Oostrum <piet at cs.uu.nl>
URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4]
Private email: piet at vanoostrum.org

More information about the Python-list mailing list