summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorGregory P. Smith <greg@mad-scientist.com>2009-03-02 05:04:04 (GMT)
committerGregory P. Smith <greg@mad-scientist.com>2009-03-02 05:04:04 (GMT)
commit4221c74cb00fa00ce8b4a6015c59a233246bf1e9 (patch)
tree0a7f4f8fddc20f15da225959d56e978d52ead6e2 /Doc
parent85685e976bd8cee44062bc1f71bf68b67dddf6c7 (diff)
downloadcpython-4221c74cb00fa00ce8b4a6015c59a233246bf1e9.zip
cpython-4221c74cb00fa00ce8b4a6015c59a233246bf1e9.tar.gz
cpython-4221c74cb00fa00ce8b4a6015c59a233246bf1e9.tar.bz2
Merged r70088 from trunk (re documentation update)
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/re.rst20
1 files changed, 12 insertions, 8 deletions
diff --git a/Doc/library/re.rst b/Doc/library/re.rst
index f466614..9399a49 100644
--- a/Doc/library/re.rst
+++ b/Doc/library/re.rst
@@ -460,19 +460,23 @@ form.
The sequence ::
- prog = re.compile(pat)
- result = prog.match(str)
+ prog = re.compile(pattern)
+ result = prog.match(string)
is equivalent to ::
- result = re.match(pat, str)
+ result = re.match(pattern, string)
- but the version using :func:`compile` is more efficient when the expression
- will be used several times in a single program.
+ but using :func:`compile` and saving the resulting regular expression object
+ for reuse is more efficient when the expression will be used several times
+ in a single program.
- .. (The compiled version of the last pattern passed to :func:`re.match` or
- :func:`re.search` is cached, so programs that use only a single regular
- expression at a time needn't worry about compiling regular expressions.)
+ .. note::
+
+ The compiled versions of the most recent patterns passed to
+ :func:`re.match`, :func:`re.search` or :func:`re.compile` are cached, so
+ programs that use only a few regular expressions at a time needn't worry
+ about compiling regular expressions.
.. data:: A