[Python-checkins] r70093 - in python/branches/release30-maint: Doc/library/re.rst
gregory.p.smith
python-checkins at python.org
Mon Mar 2 06:35:45 CET 2009
Author: gregory.p.smith
Date: Mon Mar 2 06:35:45 2009
New Revision: 70093
Log:
Merged revisions 70089 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r70089 | gregory.p.smith | 2009年03月01日 21:04:04 -0800 (2009年3月01日) | 2 lines
Merged r70088 from trunk (re documentation update)
........
Modified:
python/branches/release30-maint/ (props changed)
python/branches/release30-maint/Doc/library/re.rst
Modified: python/branches/release30-maint/Doc/library/re.rst
==============================================================================
--- python/branches/release30-maint/Doc/library/re.rst (original)
+++ python/branches/release30-maint/Doc/library/re.rst Mon Mar 2 06:35:45 2009
@@ -460,19 +460,23 @@
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
More information about the Python-checkins
mailing list