[Python-bugs-list] [ python-Bugs-697220 ] string.strip implementation/doc mismatch

SourceForge.net noreply@sourceforge.net
Tue, 04 Mar 2003 10:10:35 -0800


Bugs item #697220, was opened at 2003-03-04 13:48
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=697220&group_id=5470

Category: Documentation
Group: Python 2.2.2
>Status: Open
Resolution: Fixed
Priority: 5
Submitted By: Gerhard Häring (ghaering)
Assigned to: Neal Norwitz (nnorwitz)
Summary: string.strip implementation/doc mismatch

Initial Comment:
#v+
>>> "test".strip("t")
'es'
>>> import string
>>> print string.strip("test", "t")
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: strip() takes exactly 1 argument (2 given)
>>>
#v-

*But* the Python documentation says that not only the
string *method* strip() will allow a second optional
argument, but also the strip function in the string
module.
(http://www.python.org/doc/current/lib/module-string.html)

string.strip should be changed to accept the additional
 parameter.

----------------------------------------------------------------------

>Comment By: Gerhard Häring (ghaering)
Date: 2003-03-04 19:10

Message:
Logged In: YES 
user_id=163326

Neil, I don't think this was implemented in the 2.2
maintenance branch. That's why I'm reopening this. At least
for my 2.2 Pythons string.strip accepts one parameter only:

Python 2.2.2 (#37, Oct 14 2002, 17:02:34) [MSC 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more
information.
>>> import string
>>> string.strip("test", "t")
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: strip() takes exactly 1 argument (2 given)
>>>

and

Python 2.2.2 (#1, Feb  9 2003, 13:22:07)
[GCC 3.2.1 [FreeBSD] 20021119 (release)] on freebsd5
Type "help", "copyright", "credits" or "license" for more
information.
>>> import string
>>> string.strip("test", "t")
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: strip() takes exactly 1 argument (2 given)

Confused.

----------------------------------------------------------------------

Comment By: Neal Norwitz (nnorwitz)
Date: 2003-03-04 18:55

Message:
Logged In: YES 
user_id=33168

Gerhard, 2.2.2 does have 2 arguments, but 2.2.1 and before
do not.  We should really update the doc.  I thought this
was done, but apparently not.

Checked in as: libstring.tex 1.45.8.4

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=697220&group_id=5470