Author vstinner
Recipients Trundle, abacabadabacaba, benhoyt, brian.curtin, christian.heimes, eric.araujo, giampaolo.rodola, gregory.p.smith, loewis, ncoghlan, neologix, nvetoshkin, pitrou, rhettinger, serhiy.storchaka, socketpair, terry.reedy, tim.golden, torsten, twouters, vstinner
Date 2013-05-05.13:37:23
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <CAMpsgwY=r-b4Gy76BUKr9p=25FnzAOcPPj_Ut=S69LZoEDf=bQ@mail.gmail.com>
In-reply-to <CAH_1eM0GEn=AQEkRvLCipGiKjG2gJFu6M0=u9e4w0HW1ej0WSw@mail.gmail.com>
Content
I really like scandir() -> (name: str, stat: stat structure using None for
unknown fields).

I expect that this API to optimize use cases like:

- glob.glob("*.jpg") in a big directory with few JPEG picture
- os.walk(".") in a directory with many files: should reduce the number of
stat() to zero on most platforms

But as usual, a benchmark on a real platform would be more convicing.

Filtering entries in os.listdir() or os.scandir() would be faster (than
filtering their output), but it hard to design an API to filter arbitrary
fields (name, file type, size, ...) especially because the underlying C
functions does not provide required information. A generator is closer to
Python design and more natural.
History
Date User Action Args
2013-05-05 13:37:23vstinnersetrecipients: + vstinner, loewis, twouters, rhettinger, terry.reedy, gregory.p.smith, ncoghlan, pitrou, giampaolo.rodola, christian.heimes, tim.golden, eric.araujo, Trundle, brian.curtin, benhoyt, torsten, nvetoshkin, neologix, abacabadabacaba, socketpair, serhiy.storchaka
2013-05-05 13:37:23vstinnerlinkissue11406 messages
2013-05-05 13:37:23vstinnercreate