[issue5318] strip, rstrip lstrip bug

2009-02-19 Thread alexlc

New submission from alexlc a...@niebla.co.uk:

Examples of bad behaviour:

 'abacde'.lstrip('ab')
'cde'
 'abaaacde'.lstrip('ab')
'cde'
 'aabacde'.lstrip('aab')
'cde'
 'abcede'.rstrip( 'de' )
'abc'
 'abacdeaab'.strip('ab')
'cde'

Probably a few more similar to these will fail as well.

I have tested this with a fairly recent 2.5 (maybe 2.53 maybe 2.54), and
with 2.6.1. I have commented this to a friend and he recalls problems
similar to these with lstrip and rstrip a few years ago, so it might
have been an early 2.4 version or a late 2.3.

Thanks.

--
components: Library (Lib)
messages: 82480
nosy: alexlc
severity: normal
status: open
title: strip, rstrip  lstrip bug
type: behavior
versions: Python 2.5, Python 2.6

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5318
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5318] strip, rstrip lstrip bug

2009-02-19 Thread alexlc

alexlc a...@niebla.co.uk added the comment:

Oh, thanks for letting me know and sorry for the trouble.
I should had read the docs more carefully. I have actually been using for a
long while the strip methods as I had described in the bug report. I was so
completely convinced about this that I didn't even thought about checking
again the docs.
I have to fix my code but I am happy nonetheless as I was kind of 'losing my
faith' in python after finding this.

Regards,
Alejandro

2009/2/19 Ezio Melotti rep...@bugs.python.org


 Ezio Melotti ezio.melo...@gmail.com added the comment:

 This is not a bug:
 str.strip([chars])
  ... The chars argument is not a prefix or suffix; rather, all
 combinations of its values are stripped: ...

 http://docs.python.org/library/stdtypes.html#str.strip

 --
 nosy: +ezio.melotti

 ___
 Python tracker rep...@bugs.python.org
 http://bugs.python.org/issue5318
 ___


Added file: http://bugs.python.org/file13139/unnamed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5318
___Oh, thanks for letting me know and sorry for the trouble.brI should had read 
the docs more carefully. I have actually been using for a long while the strip 
methods as I had described in the bug report. I was so completely convinced 
about this that I didn#39;t even thought about checking again the docs.br
I have to fix my code but I am happy nonetheless as I was kind of #39;losing 
my faith#39; in python after finding 
this.brbrRegards,brAlejandrobrbrbrdiv 
class=gmail_quote2009/2/19 Ezio Melotti span dir=ltrlt;a 
href=mailto:rep...@bugs.python.org;rep...@bugs.python.org/agt;/spanbr
blockquote class=gmail_quote style=border-left: 1px solid rgb(204, 204, 
204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;br
Ezio Melotti lt;a 
href=mailto:ezio.melo...@gmail.com;ezio.melo...@gmail.com/agt; added the 
comment:br
br
This is not a bug:br
str.strip([chars])br
nbsp;... The chars argument is not a prefix or suffix; rather, allbr
combinations of its values are stripped: ...br
br
a href=http://docs.python.org/library/stdtypes.html#str.strip; 
target=_blankhttp://docs.python.org/library/stdtypes.html#str.strip/abr
br
--br
nosy: +ezio.melottibr
divdiv/divdiv class=Wj3C7cbr
___br
Python tracker lt;a 
href=mailto:rep...@bugs.python.org;rep...@bugs.python.org/agt;br
lt;a href=http://bugs.python.org/issue5318; 
target=_blankhttp://bugs.python.org/issue5318/agt;br
___br
/div/div/blockquote/divbr
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com