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

Tim Chase python.list at tim.thechases.com
Thu Aug 7 13:37:41 EDT 2014


On 2014-08-07 08:19, Roy Smith wrote:
> > 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."

I'd tend to agree that iglob() is broken and should use the
proposed .scandir() instead for exactly those reasons.
Unfortunately, it seems that it might not get back-ported
until .scandir() hits.

-tkc





More information about the Python-list mailing list