From c897890824b758c360ae661319bcc758a0f5b2b1 Mon Sep 17 00:00:00 2001 From: barneygale Date: Fri, 8 Mar 2024 20:25:33 +0000 Subject: [PATCH 1/2] GH-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*. --- Doc/library/pathlib.rst | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Doc/library/pathlib.rst b/Doc/library/pathlib.rst index 4b461a5d4a2949..39fdc7569e321a 100644 --- a/Doc/library/pathlib.rst +++ b/Doc/library/pathlib.rst @@ -1682,7 +1682,11 @@ 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. ``bytes``-based paths and :ref:`paths relative to directory descriptors +6. The values returned from pathlib's ``path.glob()`` and ``path.glob()`` + 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*. +7. ``bytes``-based paths and :ref:`paths relative to directory descriptors ` are not supported by pathlib. From 19bbaa7eba43579f7aab10ac379e9ec4d60ddb9d Mon Sep 17 00:00:00 2001 From: barneygale Date: Fri, 8 Mar 2024 20:37:45 +0000 Subject: [PATCH 2/2] Typo fix. --- Doc/library/pathlib.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/pathlib.rst b/Doc/library/pathlib.rst index 39fdc7569e321a..3237ec91feff41 100644 --- a/Doc/library/pathlib.rst +++ b/Doc/library/pathlib.rst @@ -1682,7 +1682,7 @@ 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.glob()`` +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*.