Skip to content

Commit

Permalink
pythonGH-106747: Document another difference between glob and `path…
Browse files Browse the repository at this point in the history
…lib`. (python#116518)

Document that `path.glob()` might return *path*, whereas
`glob.glob(root_dir=path)` will never return an empty string corresponding
to *path*.
  • Loading branch information
barneygale authored and adorilson committed Mar 25, 2024
1 parent 47f5202 commit 735ed97
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Doc/library/pathlib.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1682,6 +1682,10 @@ The patterns accepted and results generated by :meth:`Path.glob` and
5. The values returned from pathlib's ``path.glob()`` and ``path.rglob()``
include the *path* as a prefix, unlike the results of
``glob.glob(root_dir=path)``.
6. The values returned from pathlib's ``path.glob()`` and ``path.rglob()``
may include *path* itself, for example when globbing "``**``", whereas the
results of ``glob.glob(root_dir=path)`` never include an empty string that
would correspond to *path*.


Comparison to the :mod:`os` and :mod:`os.path` modules
Expand Down

0 comments on commit 735ed97

Please sign in to comment.