On Thu, Mar 6, 2008 at 3:16 PM, Erick Tryzelaar email@example.com wrote:
On Thu, Mar 6, 2008 at 11:37 AM, Terry Reedy firstname.lastname@example.org wrote:
fyi, I looked through a bunch of code, and it does seem that there is less need for this than I thought.
Who many such uses are like your 'foo bar for'?
The case I ran into is that I used in a fashion like 'abaaab'.lstrip('ab') before I understood exactly what strip did. The replace trick won't work for me because all of the instances where I used this were in an api, so I couldn't assume that the string i was trimming didn't have other instances of the prefix/suffix in the middle.
What about adding an optional boolean parameter to str.*strip that treats the argument as either a set of characters (default, just like now) or an exact string ? Something like