PEP proposal: enhanced string functions

Jeff Shannon jeff at ccvcorp.com
Wed Nov 14 15:06:38 EST 2001


Stephen Ferg wrote:

> PEP: XXX1
> Title: Optional pad character for string justification functions

This seems simple and occasionally useful...  though to be honest, I don't think
I've ever used justification functions, I use length-specified string substitutions
instead ( e.g., "%20s %5s" % (name, dept) ...)  Your proposal could make the
justification functions helpful enough that I might start using them, though.  ;)


>
> ===========
> PEP: XXX2
> Title: Optional argument for string strip functions

Much of the usage of this, can already be accomplished with

mystring.replace(stripchar, '')

which eliminates *all* occurences of stripchar, not just leading/trailing ones.
Whether this is preferable or not depends upon the context, of course, but I suspect
that in most cases (like both of the examples given) this would be equivalent.

Jeff Shannon
Technician/Programmer
Credit International





More information about the Python-list mailing list