Skip to content

Commit 753a0d3

Browse files
committed
gh-139580: Clarify pathlib full_match recursive pattern docs
1 parent a700732 commit 753a0d3

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

Doc/library/pathlib.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -575,6 +575,16 @@ Pure paths provide the following methods and properties:
575575
>>> PurePath('/a/b/c.py').full_match('**/*.py')
576576
True
577577

578+
The recursive wildcard "``**``" matches complete path segments. Therefore
579+
a pattern such as "``/a/**``" matches "``/a/b``", but not "``/a``":
580+
the slash before "``**``" must also be present in the path, and path
581+
objects do not preserve a trailing slash::
582+
583+
>>> PurePath('/a/b').full_match('/a/**')
584+
True
585+
>>> PurePath('/a').full_match('/a/**')
586+
False
587+
578588
.. seealso::
579589
:ref:`pathlib-pattern-language` documentation.
580590

0 commit comments

Comments
 (0)