[issue4541] Add str method for removing leading or trailing substrings

Zach Hirsch report at bugs.python.org
Fri Dec 5 02:45:04 CET 2008


Zach Hirsch <zhirsch at umich.edu> added the comment:

Thanks for taking a look.

Yea, it's pretty easy to write it in Python, but I've found that I've
needed it in quite a few things that I've worked on, so I thought it
might be useful in Python itself.

I've updated the patch to fix the reference leak.

I could imagine someone wanting to strip the same string from both
sides, e.g. "-- hello --".strips('--').strip() == "hello". It might also
be a good idea to include str.strips for parallelism with str.strip.

Added file: http://bugs.python.org/file12236/lstrips-67529.2.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4541>
_______________________________________


More information about the Python-bugs-list mailing list