![](https://secure.gravatar.com/avatar/fa0f7819f1825f596b384c19aa7dcf33.jpg?s=120&d=mm&r=g)
May 3, 2020
5:25 p.m.
Serhiy Storchaka <storchaka+cpython@gmail.com> added the comment: There is no principal difference between Path.iterdir() and os.listdir(). Somebody can change the directory during iteration. The only difference is that in the latter case you iterate in C instead of Python, so it is less easy to catch a race condition. What would happen is OS and FS specific. Depending on OS and FS it may be even possible to get the same name several times when somebody quickly creates and removes entities in the directory. ---------- nosy: +serhiy.storchaka _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue40486> _______________________________________