]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
GH-106747: Document another difference between `glob` and `pathlib`. (#116518)
authorBarney Gale <barney.gale@gmail.com>
Fri, 22 Mar 2024 19:14:09 +0000 (19:14 +0000)
committerGitHub <noreply@github.com>
Fri, 22 Mar 2024 19:14:09 +0000 (19:14 +0000)
Document that `path.glob()` might return *path*, whereas
`glob.glob(root_dir=path)` will never return an empty string corresponding
to *path*.

Doc/library/pathlib.rst

index 3ff2631d73c0b2c65ac4238ff877cae78b4ed388..4fba3622b073a7169e9925b0af3756b46d0171e1 100644 (file)
@@ -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