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.23:16:39
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <CAMpsgwaP6=U5TRY06EYvn++J6M+KfR4JzenSDVf1KyieuU5j5A@mail.gmail.com>
In-reply-to <1367790202.96.0.70313907442.issue11406@psf.upfronthosting.co.za>
Content
size = 0
for name, st in scandir(path):
    if st.st_mode is None or st.st_size is None:
        st = os.stat(os.path.join(path, name))
    if stat.S_ISREG(st.st_mode):
        size += st.st_size

It would be safer to use dir_fd parameter when supported, but I don't
think that os.scandir() should care of this problem. An higher level
API like pathlib, walkdir & cie which should be able to reuse *at() C
functions using dir_fd parameter.
History
Date User Action Args
2013-05-05 23:16:39vstinnersetrecipients: + 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 23:16:39vstinnerlinkissue11406 messages
2013-05-05 23:16:39vstinnercreate