[ python-Bugs-1104923 ] Bug in String rstrip method

SourceForge.net noreply at sourceforge.net
Wed Jan 19 02:51:52 CET 2005


Bugs item #1104923, was opened at 2005-01-18 19:58
Message generated for change (Comment added) made by dsm001
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1104923&group_id=5470

Category: Python Library
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Rick Coupland (rcouplan)
Assigned to: Nobody/Anonymous (nobody)
Summary: Bug in String rstrip method

Initial Comment:
There appears to be a data sensitive bug in the string rstrip 
method as demonstrated by the following code: 
 
>>> "ecigrcal.fle".rstrip(".fle") 
'ecigrca' 
 
As you can see, it is striping an extra character. 

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

Comment By: DSM (dsm001)
Date: 2005-01-18 20:51

Message:
Logged In: YES 
user_id=1175690

I don't think this is a bug.  The documentation for the
rstrip method reads:

rstrip(...)
    S.rstrip([chars]) -> string or unicode
    
    Return a copy of the string S with trailing whitespace
removed.
    If chars is given and not None, remove characters in
chars instead.

When you pass the method ".rle", you're telling it to treat
the four characters ".", "r", "l", and "e" as trailing
whitespace and remove them from the right side of the
string.  That's why it removes the extra "l".


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

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


More information about the Python-bugs-list mailing list