Message188443
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. |
|
Date |
User |
Action |
Args |
2013-05-05 13:37:23 | vstinner | set | recipients:
+ 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:23 | vstinner | link | issue11406 messages |
2013-05-05 13:37:23 | vstinner | create | |
|