8000 GH-106747: Document another difference between `glob` and `pathlib`. … · python/cpython@72eea51 · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 72eea51

Browse files
authored
GH-106747: Document another difference between glob and pathlib. (#116518)
Document that `path.glob()` might return *path*, whereas `glob.glob(root_dir=path)` will never return an empty string corresponding to *path*.
1 parent e28477f commit 72eea51

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Doc/library/pathlib.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1682,6 +1682,10 @@ The patterns accepted and results generated by :meth:`Path.glob` and
16821682
5. The values returned from pathlib's ``path.glob()`` and ``path.rglob()``
16831683
include the *path* as a prefix, unlike the results of
16841684
``glob.glob(root_dir=path)``.
1685+
6. The values returned from pathlib's ``path.glob()`` and ``path.rglob()``
1686+
may include *path* itself, for example when globbing "``**``", whereas the
1687+
results of ``glob.glob(root_dir=path)`` never include an empty string that
1688+
would correspond to *path*.
16851689

16861690

16871691
Comparison to the :mod:`os` and :mod:`os.path` modules

0 commit comments

Comments
 (0)
0