[issue36602] Recursive directory list with pathlib.Path.iterdir
Steve Dower
report at bugs.python.org
Fri Apr 12 11:51:21 EDT 2019
Steve Dower <steve.dower at python.org> added the comment:
Having spent more time than I'm proud of recursing through directories, I'd be happy enough with a convenience function that has sensible defaults.
If I want breadth-first recursion (and I often do), I'll write it myself. I have a slight preference for getting all files in a directory before going deeper (which is not what the PR does), and I think that's most consistent with the current behaviour.
I don't spend enough time dealing with symlinks to have strong opinions there, but given we have ways to resolve symlinks but not to get back to the original name (and I *have* had to deal with issues where I've needed to find the original name from the target :roll-eyes:) I'd say don't resolve anything eagerly.
If there's an easy and well-known algorithm for detecting infinite symlink recursion (e.g. resolve and check if it's a parent of itself) then do that and skip it, but don't return the targets.
----------
nosy: +steve.dower
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36602>
_______________________________________
More information about the Python-bugs-list
mailing list