diff options
author | Gregory P. Smith <greg@mad-scientist.com> | 2009-03-02 04:53:24 (GMT) |
---|---|---|
committer | Gregory P. Smith <greg@mad-scientist.com> | 2009-03-02 04:53:24 (GMT) |
commit | 0261e5d0b65c6a935f88f59629ea658296cb3d8a (patch) | |
tree | e35f51eeffce14df2adab3fabca545babf026c33 /Doc | |
parent | ad58b7c9da1f12499d7d926b084135e997ea96ad (diff) | |
download | cpython-0261e5d0b65c6a935f88f59629ea658296cb3d8a.zip cpython-0261e5d0b65c6a935f88f59629ea658296cb3d8a.tar.gz cpython-0261e5d0b65c6a935f88f59629ea658296cb3d8a.tar.bz2 |
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.
Diffstat (limited to 'Doc')
-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 96b452e..2237f07 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 |