Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!nntp.club.cc.cmu.edu!micro-heart-of-gold.mit.edu!bloom-beacon.mit.edu!bloom-beacon.mit.edu!panix!roy From: Roy Smith Newsgroups: comp.lang.python Subject: Re: Test for an empty directory that could be very large if it is not empty? Date: Thu, 07 Aug 2014 08:19:07 -0400 Organization: PANIX Public Access Internet and UNIX, NYC Lines: 19 Message-ID: References: NNTP-Posting-Host: localhost X-Trace: reader1.panix.com 1407413948 27850 127.0.0.1 (7 Aug 2014 12:19:08 GMT) X-Complaints-To: abuse@panix.com NNTP-Posting-Date: Thu, 7 Aug 2014 12:19:08 +0000 (UTC) User-Agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X) Xref: csiph.com comp.lang.python:75847 In article , Tim Chase 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.