Open
Description
the [Python] docs for
pathlib.glob
are unclear on the meaning of**
You are right, and it gets even more confusing:
glob.glob('**')
returns dirs and files, non-recursively, not including.
glob.glob('**', recursive=True)
returns dirs and files, recursively, not including.
list(pathlib.Path('.').glob('**'))
returns only dirs, recursively, and also includes.
I think there should be a Python upstream issue to document all of that, including the differences between glob
and pathlib
.
Then zipp
could implement what's documented for pathlib
.
Repro
Python 3.10.11
mkdir -p dir/subdir ; touch toplevel.txt dir/indir.txt
creates:
toplevel.txt
dir/
indir.txt
subdir/
>>> import glob, pathlib
>>> glob.glob('**')
['dir', 'toplevel.txt']
>>> glob.glob('**', recursive=True)
['dir', 'dir/subdir', 'dir/indir.txt', 'toplevel.txt']
>>> list(pathlib.Path('.').glob('**'))
[PosixPath('.'), PosixPath('dir'), PosixPath('dir/subdir')]
Originally posted by @nh2 in jaraco/zipp#102 (comment)
Linked PRs
Metadata
Metadata
Assignees
Projects
Status
No status