Message188254
Ah, this is great. I definitely like the idea of a generator version of os.listdir(). And I like the name iterdir() -- it fits with iteritems() etc. They've gone in 3.x, of course, but listdir didn't change to an iterator, so...
See also Betterwalk, my work-in-progress with very similar goals: https://github.com/benhoyt/betterwalk#readme
It implements iterdir(), as well as iterdir_stat() which yields (name, stat) tuples. iterdir_stat() is especially important on Windows, where the directory iteration functions (FindFirstFile/FindNextFile) already give you full stat information.
The intent of Betterwalk is to use these functions to speed up os.walk() by 2-3 times (and that's with the ctypes version, so it'll only get better in pure C).
So I'm +1 for adding iterdir(), and I'd love to see iterdir_stat() so users can write fast os.walk() type functions without resorting to C.
I'll look over the attached patches at some stage, especially the Windows code. |
|
Date |
User |
Action |
Args |
2013-05-02 07:48:41 | benhoyt | set | recipients:
+ benhoyt, loewis, twouters, rhettinger, terry.reedy, gregory.p.smith, pitrou, giampaolo.rodola, christian.heimes, tim.golden, eric.araujo, Trundle, brian.curtin, torsten, nvetoshkin, neologix, socketpair, serhiy.storchaka |
2013-05-02 07:48:41 | benhoyt | set | messageid: <1367480921.28.0.468648644876.issue11406@psf.upfronthosting.co.za> |
2013-05-02 07:48:41 | benhoyt | link | issue11406 messages |
2013-05-02 07:48:40 | benhoyt | create | |
|