[Python-ideas] adding a trim convenience function

Erick Tryzelaar idadesub at users.sourceforge.net
Thu Mar 6 21:16:16 CET 2008


On Thu, Mar 6, 2008 at 11:37 AM, Terry Reedy <tjreedy at udel.edu> 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.



More information about the Python-ideas mailing list