[Python-checkins] bpo-40016: re docstring: Clarify relationship of inline and argument flags (GH-19078)

Miss Islington (bot) webhook-mailer at python.org
Wed Mar 25 15:01:39 EDT 2020


https://github.com/python/cpython/commit/686d508c26fafb57dfe463c4f55b20013dad1441
commit: 686d508c26fafb57dfe463c4f55b20013dad1441
branch: 3.8
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2020-03-25T12:01:31-07:00
summary:

bpo-40016: re docstring: Clarify relationship of inline and argument flags (GH-19078)


Co-authored-by: Terry Jan Reedy <tjreedy at udel.edu>
(cherry picked from commit 89a2209ae6fc5f39868621799730e16f931eb497)

Co-authored-by: Ram Rachum <ram at rachum.com>

files:
A Misc/NEWS.d/next/Library/2020-03-19-19-40-27.bpo-40016.JWtxqJ.rst
M Lib/re.py

diff --git a/Lib/re.py b/Lib/re.py
index 8f1d55ddf7d69..bfb7b1ccd9346 100644
--- a/Lib/re.py
+++ b/Lib/re.py
@@ -44,7 +44,7 @@
     "|"      A|B, creates an RE that will match either A or B.
     (...)    Matches the RE inside the parentheses.
              The contents can be retrieved or matched later in the string.
-    (?aiLmsux) Set the A, I, L, M, S, U, or X flag for the RE (see below).
+    (?aiLmsux) The letters set the corresponding flags defined below.
     (?:...)  Non-grouping version of regular parentheses.
     (?P<name>...) The substring matched by the group is accessible by name.
     (?P=name)     Matches the text matched earlier by the group named name.
@@ -97,7 +97,9 @@
     purge     Clear the regular expression cache.
     escape    Backslash all non-alphanumerics in a string.
 
-Some of the functions in this module takes flags as optional parameters:
+Each function other than purge and escape can take an optional 'flags' argument
+consisting of one or more of the following module constants, joined by "|".
+A, L, and U are mutually exclusive.
     A  ASCII       For string patterns, make \w, \W, \b, \B, \d, \D
                    match the corresponding ASCII character categories
                    (rather than the whole Unicode categories, which is the
diff --git a/Misc/NEWS.d/next/Library/2020-03-19-19-40-27.bpo-40016.JWtxqJ.rst b/Misc/NEWS.d/next/Library/2020-03-19-19-40-27.bpo-40016.JWtxqJ.rst
new file mode 100644
index 0000000000000..0c6449de52799
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2020-03-19-19-40-27.bpo-40016.JWtxqJ.rst
@@ -0,0 +1 @@
+In re docstring, clarify the relationship between inline and argument compile flags.
\ No newline at end of file



More information about the Python-checkins mailing list