[Python-checkins] python/dist/src/Doc/lib libstdtypes.tex, 1.170.2.2, 1.170.2.3

rhettinger at users.sourceforge.net rhettinger at users.sourceforge.net
Tue Jan 25 11:28:50 CET 2005


Update of /cvsroot/python/python/dist/src/Doc/lib
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3666

Modified Files:
      Tag: release24-maint
	libstdtypes.tex 
Log Message:
SF bug #1105286:  Undocumented implicit strip() in split(None) string method

Clarify the behavior when a string begins or ends with whitespace.



Index: libstdtypes.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstdtypes.tex,v
retrieving revision 1.170.2.2
retrieving revision 1.170.2.3
diff -u -d -r1.170.2.2 -r1.170.2.3
--- libstdtypes.tex	1 Jan 2005 00:34:53 -0000	1.170.2.2
+++ libstdtypes.tex	25 Jan 2005 10:28:47 -0000	1.170.2.3
@@ -738,7 +738,9 @@
 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, the \emph{rightmost} ones.  If \var{sep} is not specified
-or \code{None}, any whitespace string is a separator.
+or \code{None}, any whitespace string is a separator.  Except for splitting
+from the right, \method{rsplit()} behaves like \method{split()} which
+is described in detail below.
 \versionadded{2.4}
 \end{methoddesc}
 
@@ -765,11 +767,13 @@
 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{['']}.
+algorithm is applied.  First, whitespace characters (spaces, tabs,
+newlines, returns, and formfeeds) are stripped from both ends.  Then,
+words are separated by arbitrary length strings of whitespace
+characters. Consecutive whitespace delimiters are treated as a single
+delimiter (\samp{'1  2  3'.split()} returns \samp{['1', '2', '3']}).
+Splitting an empty string or a string consisting of just whitespace
+will return \samp{['']}.
 \end{methoddesc}
 
 \begin{methoddesc}[string]{splitlines}{\optional{keepends}}



More information about the Python-checkins mailing list