summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1996-06-26 19:24:22 (GMT)
committerGuido van Rossum <guido@python.org>1996-06-26 19:24:22 (GMT)
commit6076ea51e2a04eaba105440cb12f25e0cb770f24 (patch)
treeeb31c054b0ae43119990b421bbf30763a560bec6 /Doc
parent7c2fdda0b37ad85f251a176281e6fa10fffce2c5 (diff)
downloadcpython-6076ea51e2a04eaba105440cb12f25e0cb770f24.zip
cpython-6076ea51e2a04eaba105440cb12f25e0cb770f24.tar.gz
cpython-6076ea51e2a04eaba105440cb12f25e0cb770f24.tar.bz2
Added thread unsafety warning. Added optional retain arg to split.
Diffstat (limited to 'Doc')
-rw-r--r--Doc/lib/libregsub.tex7
-rw-r--r--Doc/libregsub.tex7
2 files changed, 12 insertions, 2 deletions
diff --git a/Doc/lib/libregsub.tex b/Doc/lib/libregsub.tex
index 5747e4f..bbb7671 100644
--- a/Doc/lib/libregsub.tex
+++ b/Doc/lib/libregsub.tex
@@ -4,6 +4,8 @@
This module defines a number of functions useful for working with
regular expressions (see built-in module \code{regex}).
+Warning: these functions are not thread-safe.
+
\renewcommand{\indexsubitem}{(in module regsub)}
\begin{funcdesc}{sub}{pat\, repl\, str}
Replace the first occurrence of pattern \var{pat} in string
@@ -21,10 +23,13 @@ when not adjacent to a previous match, so e.g.
\code{gsub('', '-', 'abc')} returns \code{'-a-b-c-'}.
\end{funcdesc}
-\begin{funcdesc}{split}{str\, pat}
+\begin{funcdesc}{split}{str\, pat\optional{\, retain}}
Split the string \var{str} in fields separated by delimiters matching
the pattern \var{pat}, and return a list containing the fields. Only
non-empty matches for the pattern are considered, so e.g.
\code{split('a:b', ':*')} returns \code{['a', 'b']} and
\code{split('abc', '')} returns \code{['abc']}.
+If the optional \var{retain} argument is true, the separators are also
+inserted in the list, so e.g. \code{split('a:::b', ':*', 1)} returns
+\code{['a', ':::', 'b']}.
\end{funcdesc}
diff --git a/Doc/libregsub.tex b/Doc/libregsub.tex
index 5747e4f..bbb7671 100644
--- a/Doc/libregsub.tex
+++ b/Doc/libregsub.tex
@@ -4,6 +4,8 @@
This module defines a number of functions useful for working with
regular expressions (see built-in module \code{regex}).
+Warning: these functions are not thread-safe.
+
\renewcommand{\indexsubitem}{(in module regsub)}
\begin{funcdesc}{sub}{pat\, repl\, str}
Replace the first occurrence of pattern \var{pat} in string
@@ -21,10 +23,13 @@ when not adjacent to a previous match, so e.g.
\code{gsub('', '-', 'abc')} returns \code{'-a-b-c-'}.
\end{funcdesc}
-\begin{funcdesc}{split}{str\, pat}
+\begin{funcdesc}{split}{str\, pat\optional{\, retain}}
Split the string \var{str} in fields separated by delimiters matching
the pattern \var{pat}, and return a list containing the fields. Only
non-empty matches for the pattern are considered, so e.g.
\code{split('a:b', ':*')} returns \code{['a', 'b']} and
\code{split('abc', '')} returns \code{['abc']}.
+If the optional \var{retain} argument is true, the separators are also
+inserted in the list, so e.g. \code{split('a:::b', ':*', 1)} returns
+\code{['a', ':::', 'b']}.
\end{funcdesc}