This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author torsten
Recipients Trundle, brian.curtin, eric.araujo, giampaolo.rodola, loewis, neologix, nvetoshkin, pitrou, socketpair, terry.reedy, torsten
Date 2011-03-12.23:44:59
SpamBayes Score 1.10051e-10
Marked as misclassified No
Message-id <>
I would regard this as Type: resource usage, instead of performance. Given enough RAM, loading the whole directory at once will likely be faster.

The downsides of os.listdir:
a) You can't get a peek at the files so far, it's all or nothing. I only wanted to know if a directory is empty and I have to read the whole thing just to throw it away (maybe I missed another library function?)

b) Using it in a GUI basically requires you to use threads if you may run into a dir with many files. Especially on a slow filesystem (network). Because you won't regain control until the whole thing is read.

I would like to have an iterator version as well, but I also dislike another function (especially the "x" prefix). How about adding a keyword argument to select iterator behaviour?
Date User Action Args
2011-03-12 23:45:01torstensetrecipients: + torsten, loewis, terry.reedy, pitrou, giampaolo.rodola, eric.araujo, Trundle, brian.curtin, nvetoshkin, neologix, socketpair
2011-03-12 23:45:01torstensetmessageid: <>
2011-03-12 23:44:59torstenlinkissue11406 messages
2011-03-12 23:44:59torstencreate