[Python-checkins] python/dist/src/Doc/lib libstdtypes.tex, 1.170.2.8, 1.170.2.9

rhettinger@users.sourceforge.net rhettinger at users.sourceforge.net
Tue May 31 12:28:09 CEST 2005


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

Modified Files:
      Tag: release24-maint
	libstdtypes.tex 
Log Message:
SF bug #1202395:  Description of string.lstrip() needs improvement

Clarify the role of the chars argument in the strip() methods.



Index: libstdtypes.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstdtypes.tex,v
retrieving revision 1.170.2.8
retrieving revision 1.170.2.9
diff -u -d -r1.170.2.8 -r1.170.2.9
--- libstdtypes.tex	27 May 2005 10:45:14 -0000	1.170.2.8
+++ libstdtypes.tex	31 May 2005 10:28:07 -0000	1.170.2.9
@@ -699,11 +699,17 @@
 \end{methoddesc}
 
 \begin{methoddesc}[string]{lstrip}{\optional{chars}}
-Return a copy of the string with leading characters removed.  If
-\var{chars} is omitted or \code{None}, whitespace characters are
-removed.  If given and not \code{None}, \var{chars} must be a string;
-the characters in the string will be stripped from the beginning of
-the string this method is called on.
+Return a copy of the string with leading characters removed.  The
+\var{chars} argument is a string specifying the set of characters
+to be removed.  If omitted or \code{None}, the \var{chars} argument
+defaults to removing whitespace.  The \var{chars} argument is not
+a prefix; rather, all combinations of its values are stripped:
+\begin{verbatim}
+    >>> '   spacious   '.lstrip()
+    'spacious   '
+    >>> 'www.example.com'.lstrip('cmowz.')
+    'example.com'
+\end{verbatim}
 \versionchanged[Support for the \var{chars} argument]{2.2.2}
 \end{methoddesc}
 
@@ -745,11 +751,17 @@
 \end{methoddesc}
 
 \begin{methoddesc}[string]{rstrip}{\optional{chars}}
-Return a copy of the string with trailing characters removed.  If
-\var{chars} is omitted or \code{None}, whitespace characters are
-removed.  If given and not \code{None}, \var{chars} must be a string;
-the characters in the string will be stripped from the end of the
-string this method is called on.
+Return a copy of the string with trailing characters removed.  The
+\var{chars} argument is a string specifying the set of characters
+to be removed.  If omitted or \code{None}, the \var{chars} argument
+defaults to removing whitespace.  The \var{chars} argument is not
+a suffix; rather, all combinations of its values are stripped:
+\begin{verbatim}
+    >>> '   spacious   '.rstrip()
+    '   spacious'
+    >>> 'mississippi'.rstrip('ipz')
+    'mississ'
+\end{verbatim}
 \versionchanged[Support for the \var{chars} argument]{2.2.2}
 \end{methoddesc}
 
@@ -791,11 +803,17 @@
 \end{methoddesc}
 
 \begin{methoddesc}[string]{strip}{\optional{chars}}
-Return a copy of the string with leading and trailing characters
-removed.  If \var{chars} is omitted or \code{None}, whitespace
-characters are removed.  If given and not \code{None}, \var{chars}
-must be a string; the characters in the string will be stripped from
-the both ends of the string this method is called on.
+Return a copy of the string with the leading and trailing characters
+removed.  The \var{chars} argument is a string specifying the set of
+characters to be removed.  If omitted or \code{None}, the \var{chars}
+argument defaults to removing whitespace.  The \var{chars} argument is not
+a prefix or suffix; rather, all combinations of its values are stripped:
+\begin{verbatim}
+    >>> '   spacious   '.strip()
+    'spacious'
+    >>> 'www.example.com'.strip('cmowz.')
+    'example'
+\end{verbatim}
 \versionchanged[Support for the \var{chars} argument]{2.2.2}
 \end{methoddesc}
 



More information about the Python-checkins mailing list