STINNER Victor added the comment: 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. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue11406> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com