
The main issue is the lack of stat caching. That is why I wrote my own module around scandir which includes the DirEntry objects for each path so that the consumer can also do stuff with the cached stat info (like check if it is a file or directory). Often we won't need to call stat on the path at all, and if we do it will only be once. Brendan Moloney Research Associate Advanced Imaging Research Center Oregon Health Science University ________________________________ From: Python-ideas [python-ideas-bounces+moloney=ohsu.edu@python.org] on behalf of Guido van Rossum [guido@python.org] Sent: Tuesday, January 05, 2016 12:21 PM To: Chris Barker - NOAA Federal Cc: Python-Ideas Subject: Re: [Python-ideas] find-like functionality in pathlib On Tue, Jan 5, 2016 at 8:37 AM, Chris Barker - NOAA Federal <chris.barker@noaa.gov<mailto:chris.barker@noaa.gov>> wrote:
Note that the PEP doesn't mention rglob() -- why do we even have it? It seems rglob(pat) is exactly the same as glob('**/' + path) (assuming os.sep is '/'). No TOOWTDI here?
Much as I believe in TOOWTDI, I like having rglob(). "**/" is the kind of magic a newbie ( like me :-) ) would have research and understand. Sure. It's too late to remove it anyway. Is there anything actionable here besides fixing the PermissionError and the behavior under symlink loops? IMO if you want files only or directories only you can just add a filter using e.g. is_dir(): p = pathlib.Path.cwd() real_dirs = [p for p in p.rglob('*') if p.is_dir() and not p.is_symlink()] -- --Guido van Rossum (python.org/~guido<http://python.org/~guido>)