[Python-checkins] python/dist/src/Doc/lib libstdtypes.tex,
1.129.8.10, 1.129.8.11
rhettinger at users.sourceforge.net
rhettinger at users.sourceforge.net
Mon Sep 6 17:54:46 CEST 2004
Update of /cvsroot/python/python/dist/src/Doc/lib
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25015
Modified Files:
Tag: release23-maint
libstdtypes.tex
Log Message:
SF bug #901654: split method documentation can be improved
Backport to Py2.3.
Index: libstdtypes.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstdtypes.tex,v
retrieving revision 1.129.8.10
retrieving revision 1.129.8.11
diff -u -d -r1.129.8.10 -r1.129.8.11
--- libstdtypes.tex 3 Jun 2004 09:48:25 -0000 1.129.8.10
+++ libstdtypes.tex 6 Sep 2004 15:54:43 -0000 1.129.8.11
@@ -719,8 +719,22 @@
\begin{methoddesc}[string]{split}{\optional{sep \optional{,maxsplit}}}
Return a list of the words in the string, using \var{sep} as the
delimiter string. If \var{maxsplit} is given, at most \var{maxsplit}
-splits are done. If \var{sep} is not specified or \code{None}, any
-whitespace string is a separator.
+splits are done. (thus, the list will have at most \code{\var{maxsplit}+1}
+elements). If \var{maxsplit} is not specified or is zero, then there
+is no limit on the number of splits (all possible splits are made).
+Consecutive delimiters are not grouped together and are
+deemed to delimit empty strings (for example, \samp{'1,,2'.split(',')}
+returns \samp{['1', '', '2']}). The \var{sep} argument may consist of
+multiple characters (for example, \samp{'1, 2, 3'.split(', ')} returns
+\samp{['1', '2', '3']}). Splitting an empty string with a specified
+separator returns an empty list.
+
+If \var{sep} is not specified or is \code{None}, a different splitting
+algorithm is applied. Words are separated by arbitrary length strings of
+whitespace characters (spaces, tabs, newlines, returns, and formfeeds).
+Consecutive whitespace delimiters are treated as a single delimiter
+(\samp{'1 2 3'.split()} returns \samp{['1', '2', '3']}). Splitting an
+empty string returns \samp{['']}.
\end{methoddesc}
\begin{methoddesc}[string]{splitlines}{\optional{keepends}}
More information about the Python-checkins
mailing list