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

Roy Smith roy at panix.com
Thu Aug 7 21:10:52 EDT 2014


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

> 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

I opened a bug against the 2.7 docs:

http://bugs.python.org/issue22167



More information about the Python-list mailing list