summaryrefslogtreecommitdiffstats
path: root/Misc/NEWS.d
diff options
context:
space:
mode:
authorBarney Gale <barney.gale@gmail.com>2023-11-13 17:15:56 (GMT)
committerGitHub <noreply@github.com>2023-11-13 17:15:56 (GMT)
commitcf67ebfb315ce36175f3d425249d7c6560f6d0d5 (patch)
tree3007eaa7164eba027714b9752aecea60627e6de6 /Misc/NEWS.d
parentbabb787047e0f7807c8238d3b1a3128dac30bd5c (diff)
downloadcpython-cf67ebfb315ce36175f3d425249d7c6560f6d0d5.zip
cpython-cf67ebfb315ce36175f3d425249d7c6560f6d0d5.tar.gz
cpython-cf67ebfb315ce36175f3d425249d7c6560f6d0d5.tar.bz2
GH-72904: Add `glob.translate()` function (#106703)
Add `glob.translate()` function that converts a pathname with shell wildcards to a regular expression. The regular expression is used by pathlib to implement `match()` and `glob()`. This function differs from `fnmatch.translate()` in that wildcards do not match path separators by default, and that a `*` pattern segment matches precisely one path segment. When *recursive* is set to true, `**` pattern segments match any number of path segments, and `**` cannot appear outside its own segment. In pathlib, this change speeds up directory walking (because `_make_child_relpath()` does less work), makes path objects smaller (they don't need a `_lines` slot), and removes the need for some gnarly code. Co-authored-by: Jason R. Coombs <jaraco@jaraco.com> Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Diffstat (limited to 'Misc/NEWS.d')
-rw-r--r--Misc/NEWS.d/next/Library/2023-07-13-00-24-52.gh-issue-72904.Yn5-j0.rst2
1 files changed, 2 insertions, 0 deletions
diff --git a/Misc/NEWS.d/next/Library/2023-07-13-00-24-52.gh-issue-72904.Yn5-j0.rst b/Misc/NEWS.d/next/Library/2023-07-13-00-24-52.gh-issue-72904.Yn5-j0.rst
new file mode 100644
index 0000000..edc8ab0
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2023-07-13-00-24-52.gh-issue-72904.Yn5-j0.rst
@@ -0,0 +1,2 @@
+Add :func:`glob.translate`. This function converts a pathname with shell-style
+wildcards to a regular expression.