Torsten Landschoff <t.landsch...@gmx.net> added the comment:

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?

----------
nosy: +torsten

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue11406>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to