Test for an empty directory that could be very large if it is not empty?

Roy Smith roy at panix.com
Thu Aug 7 08:19:07 EDT 2014


In article <mailman.12725.1407413212.18130.python-list at python.org>,
 Tim Chase <python.list at tim.thechases.com> wrote:

> On 2014-08-07 07:54, Roy Smith wrote:
> > I wonder if glob.iglob('*') might help here?
> 
> My glob.iglob() uses os.listdir() behind the scenes (see glob1() in
> glob.py)
> 
> -tkc

In which case, the documentation for iglob() is broken.  It says:

"Return an iterator which yields the same values as glob() without 
actually storing them all simultaneously."

If it's calling something which does store them all simultaneously, 
that's like contracting with somebody to commit a crime, and then trying 
to claim you're innocent because you didn't commit the crime yourself.



More information about the Python-list mailing list