[Python-Dev] Small feature request - optional argument for string.strip()

Guido van Rossum guido@digicool.com
Wed, 25 Jul 2001 13:22:53 -0400


> Is it OK to post small feature requests directly to this list, or is
> there some other mechanism for them? What I have in mind certainly
> isn't worth a PEP.

It's better to use the SF feture request tracker:
http://sourceforge.net/tracker/?atid=355470&group_id=5470&func=browse

> The .split method on strings splits at whitespace by default, but
> takes an optional argument allowing splitting by other strings. The
> .strip method (and its siblings) always strip whitespace - on more
> than one occasion I would have found it useful if these methods also
> took an optional argument allowing other strings to be stripped. For
> example, to strip, say, asterisks from a file you could do:
> 
> >>>fred = '**word**word**'
> >>>fred.strip('*')
> word**word
> 
> Does this sound sensible/useful?

Marginally.

--Guido van Rossum (home page: http://www.python.org/~guido/)