This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author facundobatista
Recipients docs@python, facundobatista, pitrou, serhiy.storchaka
Date 2020-08-30.16:48:49
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <[email protected]>
In-reply-to
Content
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).
History
Date User Action Args
2020-08-30 16:48:49facundobatistasetrecipients: + facundobatista, pitrou, docs@python, serhiy.storchaka
2020-08-30 16:48:49facundobatistasetmessageid: <[email protected]>
2020-08-30 16:48:49facundobatistalinkissue40486 messages
2020-08-30 16:48:49facundobatistacreate