diff options
author | Gregory P. Smith <greg@mad-scientist.com> | 2009-03-02 05:25:11 +0000 |
---|---|---|
committer | Gregory P. Smith <greg@mad-scientist.com> | 2009-03-02 05:25:11 +0000 |
commit | 13b19c1f94a3a7a149cc7109b46693df62114530 (patch) | |
tree | c494b725c06e91287a2fb8a3fc841760a9abb5dd | |
parent | e392b4ff112fed3abc06809ecf8f49fc1ca02813 (diff) | |
download | cpython-git-13b19c1f94a3a7a149cc7109b46693df62114530.tar.gz |
Merged revisions 70088 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r70088 | gregory.p.smith | 2009-03-01 20:53:24 -0800 (Sun, 01 Mar 2009) | 4 lines
The note about caching of regular expression objects was incorrect ReST and
thus invisible in the compiled documentation. Fixed. Also I cleaned up the
wording.
........
-rw-r--r-- | Doc/library/re.rst | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/Doc/library/re.rst b/Doc/library/re.rst index 96b452ecc6..2237f070b9 100644 --- a/Doc/library/re.rst +++ b/Doc/library/re.rst @@ -440,19 +440,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:: I |