PEP proposal: enhanced string functions

Matthew Dixon Cowles matt at mondoinfo.com
Tue Nov 13 23:15:29 EST 2001


On 13 Nov 2001 12:54:47 -0800, Stephen Ferg <steve at ferg.org> wrote:

Steve,

>Title: Optional pad character for string justification functions

I like this.

>Title: Optional argument for string strip functions

>    The proposal is to allow these functions and methods to take one
>    optional argument in addition to the arguments that they now
>    accept.  The argument is called "stripchar".  If the stripchar
>    argument is unspecified or is specified as None, then these
>    functions and methods will do exactly what they now do, and strip
>    whitespace. If the stripchar argument is specified, and not
>    specified as None, it must contain a single character. If the
>    stripchar argument is specified, then rather than stripping out
>    whitespace, the functions and methods will strip out the
>    specified stripchar character.

This bothers me a bit for the same reason that the split() method
does. It strikes me as weird that without arguments, split() splits on
all whitespace but that it will only take one character as an
argument. I'd prefer to be able to pass a sequence to strip() and have
any of those characters stripped.

Regards,
Matt



More information about the Python-list mailing list