[issue4541] Add str method for removing leading or trailing substrings
Amaury Forgeot d'Arc
report at bugs.python.org
Fri Dec 5 02:17:53 CET 2008
Amaury Forgeot d'Arc <amauryfa at gmail.com> added the comment:
I cannot say if this new set of function is desirable in python, but I know that
I already needed this feature sometimes.
It's very easy to write in python code, though:
def rstrips(s, suffix):
if suffix and s.endswith(suffix):
s = s[:-len(suffix)]
return s
About the patch:
- there is a reference leak in string_strips: lstripped must be decref'd
- this both-ends function seems less useful: prefixes are often different from
suffixes.
----------
nosy: +amaury.forgeotdarc
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4541>
_______________________________________
More information about the Python-bugs-list
mailing list