PEP proposal: enhanced string functions

Martin Franklin martin.franklin at westgeo.com
Wed Nov 14 10:27:16 CET 2001



Matthew Dixon Cowles wrote:

> 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.

Me too.


> 
>>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.


how about adding new methods stripc(), rstripc(), lstripc(),  (or 
stripchar()) then maybe stripword() etc for what you want......




> 
> Regards,
> Matt
> 




More information about the Python-list mailing list