New submission from Barney Gale <barney.g...@gmail.com>:
`pathlib.Path.iterdir()` uses `os.listdir()` rather than `os.scandir()`. I think this has a small performance cost, per PEP 471: > It returns a generator instead of a list, so that scandir acts as a true > iterator instead of returning the full list immediately. As `scandir()` is already available from `_NormalAccessor` it's a simple patch to use `scandir()` instead. ---------- components: Library (Lib) messages: 363689 nosy: barneygale priority: normal severity: normal status: open title: `pathlib.Path.iterdir()` wastes memory by using `os.listdir()` rather than `os.scandir()` type: resource usage versions: Python 3.9 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue39907> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com