Commit 23e21e7c authored by Guido van Rossum's avatar Guido van Rossum

Minor editing corrections.

parent 983c930c
...@@ -45,7 +45,7 @@ atol_error = ValueError ...@@ -45,7 +45,7 @@ atol_error = ValueError
def lower(s): def lower(s):
"""lower(s) -> string """lower(s) -> string
Return a copy of the string s converted to lowercase Return a copy of the string s converted to lowercase.
""" """
res = '' res = ''
...@@ -57,7 +57,7 @@ def lower(s): ...@@ -57,7 +57,7 @@ def lower(s):
def upper(s): def upper(s):
"""upper(s) -> string """upper(s) -> string
Return a copy of the string s converted to uppercase Return a copy of the string s converted to uppercase.
""" """
res = '' res = ''
...@@ -67,10 +67,10 @@ def upper(s): ...@@ -67,10 +67,10 @@ def upper(s):
# Swap lower case letters and UPPER CASE # Swap lower case letters and UPPER CASE
def swapcase(s): def swapcase(s):
"""swapcase(s) -> strng """swapcase(s) -> string
Return a copy of the string s with upper case characters Return a copy of the string s with upper case characters
converted to lowercase and vice versa converted to lowercase and vice versa.
""" """
res = '' res = ''
...@@ -83,7 +83,7 @@ def strip(s): ...@@ -83,7 +83,7 @@ def strip(s):
"""strip(s) -> string """strip(s) -> string
Return a copy of the string s with leading and trailing Return a copy of the string s with leading and trailing
whitespace removed whitespace removed.
""" """
i, j = 0, len(s) i, j = 0, len(s)
...@@ -95,7 +95,7 @@ def strip(s): ...@@ -95,7 +95,7 @@ def strip(s):
def lstrip(s): def lstrip(s):
"""lstrip(s) -> string """lstrip(s) -> string
Return a copy of the string s with leading whitespace removed Return a copy of the string s with leading whitespace removed.
""" """
i, j = 0, len(s) i, j = 0, len(s)
...@@ -106,7 +106,8 @@ def lstrip(s): ...@@ -106,7 +106,8 @@ def lstrip(s):
def rstrip(s): def rstrip(s):
"""rstrip(s) -> string """rstrip(s) -> string
Return a copy of the string s with trailing whitespace removed Return a copy of the string s with trailing whitespace
removed.
""" """
i, j = 0, len(s) i, j = 0, len(s)
...@@ -174,7 +175,6 @@ def splitfields(s, sep=None, maxsplit=0): ...@@ -174,7 +175,6 @@ def splitfields(s, sep=None, maxsplit=0):
res.append(s[i:j]) res.append(s[i:j])
i = j = j + nsep i = j = j + nsep
if count >= maxsplit: break if count >= maxsplit: break
else: else:
j = j + 1 j = j + 1
res.append(s[i:]) res.append(s[i:])
...@@ -185,8 +185,8 @@ def join(words, sep = ' '): ...@@ -185,8 +185,8 @@ def join(words, sep = ' '):
"""join(list [,sep]) -> string """join(list [,sep]) -> string
Return a string composed of the words in list, with Return a string composed of the words in list, with
intervening occurences of sep. The default separator is a intervening occurences of sep. Sep defaults to a single
single space. space.
(joinfields and join are synonymous) (joinfields and join are synonymous)
...@@ -306,7 +306,7 @@ def rfind(s, sub, i = 0, last=None): ...@@ -306,7 +306,7 @@ def rfind(s, sub, i = 0, last=None):
such that sub is contained within s[start,end]. Optional such that sub is contained within s[start,end]. Optional
arguments start and end are interpreted as in slice notation. arguments start and end are interpreted as in slice notation.
Returns -1 on failure. Return -1 on failure.
""" """
Slen = len(s) # cache this value, for speed Slen = len(s) # cache this value, for speed
...@@ -484,7 +484,7 @@ def expandtabs(s, tabsize=8): ...@@ -484,7 +484,7 @@ def expandtabs(s, tabsize=8):
Return a copy of the string s with all tab characters replaced Return a copy of the string s with all tab characters replaced
by the appropriate number of spaces, depending on the current by the appropriate number of spaces, depending on the current
column, and the tabsize (default=8). column, and the tabsize (default 8).
""" """
res = line = '' res = line = ''
......
...@@ -45,7 +45,7 @@ atol_error = ValueError ...@@ -45,7 +45,7 @@ atol_error = ValueError
def lower(s): def lower(s):
"""lower(s) -> string """lower(s) -> string
Return a copy of the string s converted to lowercase Return a copy of the string s converted to lowercase.
""" """
res = '' res = ''
...@@ -57,7 +57,7 @@ def lower(s): ...@@ -57,7 +57,7 @@ def lower(s):
def upper(s): def upper(s):
"""upper(s) -> string """upper(s) -> string
Return a copy of the string s converted to uppercase Return a copy of the string s converted to uppercase.
""" """
res = '' res = ''
...@@ -67,10 +67,10 @@ def upper(s): ...@@ -67,10 +67,10 @@ def upper(s):
# Swap lower case letters and UPPER CASE # Swap lower case letters and UPPER CASE
def swapcase(s): def swapcase(s):
"""swapcase(s) -> strng """swapcase(s) -> string
Return a copy of the string s with upper case characters Return a copy of the string s with upper case characters
converted to lowercase and vice versa converted to lowercase and vice versa.
""" """
res = '' res = ''
...@@ -83,7 +83,7 @@ def strip(s): ...@@ -83,7 +83,7 @@ def strip(s):
"""strip(s) -> string """strip(s) -> string
Return a copy of the string s with leading and trailing Return a copy of the string s with leading and trailing
whitespace removed whitespace removed.
""" """
i, j = 0, len(s) i, j = 0, len(s)
...@@ -95,7 +95,7 @@ def strip(s): ...@@ -95,7 +95,7 @@ def strip(s):
def lstrip(s): def lstrip(s):
"""lstrip(s) -> string """lstrip(s) -> string
Return a copy of the string s with leading whitespace removed Return a copy of the string s with leading whitespace removed.
""" """
i, j = 0, len(s) i, j = 0, len(s)
...@@ -106,7 +106,8 @@ def lstrip(s): ...@@ -106,7 +106,8 @@ def lstrip(s):
def rstrip(s): def rstrip(s):
"""rstrip(s) -> string """rstrip(s) -> string
Return a copy of the string s with trailing whitespace removed Return a copy of the string s with trailing whitespace
removed.
""" """
i, j = 0, len(s) i, j = 0, len(s)
...@@ -174,7 +175,6 @@ def splitfields(s, sep=None, maxsplit=0): ...@@ -174,7 +175,6 @@ def splitfields(s, sep=None, maxsplit=0):
res.append(s[i:j]) res.append(s[i:j])
i = j = j + nsep i = j = j + nsep
if count >= maxsplit: break if count >= maxsplit: break
else: else:
j = j + 1 j = j + 1
res.append(s[i:]) res.append(s[i:])
...@@ -185,8 +185,8 @@ def join(words, sep = ' '): ...@@ -185,8 +185,8 @@ def join(words, sep = ' '):
"""join(list [,sep]) -> string """join(list [,sep]) -> string
Return a string composed of the words in list, with Return a string composed of the words in list, with
intervening occurences of sep. The default separator is a intervening occurences of sep. Sep defaults to a single
single space. space.
(joinfields and join are synonymous) (joinfields and join are synonymous)
...@@ -306,7 +306,7 @@ def rfind(s, sub, i = 0, last=None): ...@@ -306,7 +306,7 @@ def rfind(s, sub, i = 0, last=None):
such that sub is contained within s[start,end]. Optional such that sub is contained within s[start,end]. Optional
arguments start and end are interpreted as in slice notation. arguments start and end are interpreted as in slice notation.
Returns -1 on failure. Return -1 on failure.
""" """
Slen = len(s) # cache this value, for speed Slen = len(s) # cache this value, for speed
...@@ -484,7 +484,7 @@ def expandtabs(s, tabsize=8): ...@@ -484,7 +484,7 @@ def expandtabs(s, tabsize=8):
Return a copy of the string s with all tab characters replaced Return a copy of the string s with all tab characters replaced
by the appropriate number of spaces, depending on the current by the appropriate number of spaces, depending on the current
column, and the tabsize (default=8). column, and the tabsize (default 8).
""" """
res = line = '' res = line = ''
......
...@@ -32,9 +32,10 @@ PERFORMANCE OF THIS SOFTWARE. ...@@ -32,9 +32,10 @@ PERFORMANCE OF THIS SOFTWARE.
/* strop module */ /* strop module */
static char strop_module__doc__[] = static char strop_module__doc__[] =
"Common string manipulations, optimized for speed\n\ "Common string manipulations, optimized for speed.\n\
Always use \"import string\" rather than referencing\n\ Always use \"import string\" rather than referencing\n\
this module directly"; this module directly.";
#include "Python.h" #include "Python.h"
...@@ -192,10 +193,10 @@ static char joinfields__doc__[] = ...@@ -192,10 +193,10 @@ static char joinfields__doc__[] =
joinfields(list [,sep]) -> string\n\ joinfields(list [,sep]) -> string\n\
\n\ \n\
Return a string composed of the words in list, with\n\ Return a string composed of the words in list, with\n\
intervening occurences of sep. The default separator is a\n\ intervening occurences of sep. Sep defaults to a single\n\
single space.\n\ space.\n\
\n\ \n\
(joinfields and join are synonymous)"; (join and joinfields are synonymous)";
static PyObject * static PyObject *
strop_joinfields(self, args) strop_joinfields(self, args)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment