Skip to content

Commit c897890

Browse files
committed
pythonGH-106747: Document another difference between glob and pathlib.
Document that `path.glob()` might return *path*, whereas `glob.glob(root_dir=path)` will never return an empty string corresponding to *path*.
1 parent 735fc2c commit c897890

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Doc/library/pathlib.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1682,7 +1682,11 @@ 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. ``bytes``-based paths and :ref:`paths relative to directory descriptors
1685+
6. The values returned from pathlib's ``path.glob()`` and ``path.glob()``
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*.
1689+
7. ``bytes``-based paths and :ref:`paths relative to directory descriptors
16861690
<dir_fd>` are not supported by pathlib.
16871691

16881692

0 commit comments

Comments
 (0)