Facundo Batista <facu...@taniquetil.com.ar> added the comment:

However, Serhiy, `os.listdir()` builds a list quickly and gives you that, so 
the chance of the directory being modified is quite low (however, for big 
directories, that may happen, and it's probably good to notice that in the 
docs).

For `Path.iterdir()` that list is not built, and as it's iteration is external, 
the amount of time between getting one item to the other is unbound, *anything* 
could happen in the middle. 

In short, I think that both docs should state that the directory could change 
while it's iterated (in the os.listdir case probably stating that the chances 
are low).

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue40486>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to