[Python-Dev] [maintenance doc updates] (original) (raw)

Patrick K. O'Brien pobrien@orbtech.com
Fri, 15 Nov 2002 19:35:29 -0600


On Friday 15 November 2002 06:59 pm, Fred L. Drake wrote:

The maintenance version of the documentation has been updated:

http://www.python.org/dev/doc/maint22/ Small updates. Add embarrassing note about sneaky feeping creaturism: The "chars" argument to str.strip(), .lstrip(), and .rstrip(), as well as the str.zfill() method, were all added in Python 2.2.2! Woe to over-eager backporters!

The string module docstrings for lstrip and rstrip need updating as well then. It looks like only strip has been updated so far. And it would be good if this argument was called the same thing in the string type as in the string module. The one calls it sep and the other chars. In fact, the docstring for string.strip mixes the two:

def strip(s, chars=None): """strip(s [,chars]) -> string

Return a copy of the string s with leading and trailing
whitespace removed.
If chars is given and not None, remove characters in sep instead.
If chars is unicode, S will be converted to unicode before 

stripping.

"""
return s.strip(chars)

The docstring for the type still calls it sep, as does lstrip and rstrip:

PyDoc_STRVAR(strip__doc__, "S.strip([sep]) -> string or unicode\n
\n
Return a copy of the string S with leading and trailing\n
whitespace removed.\n
If sep is given and not None, remove characters in sep instead.\n
If sep is unicode, S will be converted to unicode before stripping");

It looks like the documentation is consistent in calling it chars, but the implementation is lagging behind.

-- Patrick K. O'Brien Orbtech http://www.orbtech.com/web/pobrien

"Your source for Python programming expertise."