[issue34541] pathlib.Path.iterdir doesn't throw an exception until you start iterating

Paul Pinterits report at bugs.python.org
Wed Aug 29 13:06:39 EDT 2018


Paul Pinterits <rawing7 at gmail.com> added the comment:

As an afterthought, I'd like to suggest an alternative solution: If changing the `iterdir` behavior is not possible or not desirable for some reason, please add a `Path.listdir` method that returns a list instead of an iterator. Lazy file system operations can often introduce unnecessary race conditions in the code, so I believe it would be very useful if every lazy method had an eager equivalent.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34541>
_______________________________________


More information about the Python-bugs-list mailing list