On Mon, Jan 4, 2016 at 9:25 PM, Guido van Rossum <guido@python.org> wrote:
Following up on this, in theory the right way to walk a tree using pathlib already exists, it's the rglob() method. E.g. all paths under /foo/bar should be found as follows:

  for path in pathlib.Path('/foo/bar').rglob('**/*'):

Whoops, I just realized that I combined two ways of doing a recursive glob here. It should be either rglob('*') or plain glob('**/*'). What I wrote produces identical results, but at the cost of a lot of caching. :-)

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?

--
--Guido van Rossum (python.org/~guido)