[New-bugs-announce] [issue12444] accept sets or collections for str.strip/lstrip/rstrip

Peter Eisentraut report at bugs.python.org
Wed Jun 29 22:56:37 CEST 2011

New submission from Peter Eisentraut <peter_e at gmx.net>:

It appears to be a pretty common mistake to think that the argument of str.strip/lstrip/rstrip is a substring rather than a set of characters.  To allow a more clearer notation, it would be nice if these functions also accepted an argument other than a string, for example a set or any collection.  Then you could write, for example:

a.strip({'a', 'b', 'c'})

I suggest to either add support for sets specifically, or more generally anything that supports the "in" operator.

I can try to code it up if it sounds acceptable.

components: Library (Lib)
messages: 139449
nosy: petere
priority: normal
severity: normal
status: open
title: accept sets or collections for str.strip/lstrip/rstrip
type: feature request

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list