[Python-Dev] String methods... finally
Tim Peters
tim_one at email.msn.com
Sat Jun 12 02:56:03 CEST 1999
[Skip Montanaro]
> I see the following functions in string.py that could
> reasonably be methodized:
>
> ljust, rjust, center, expandtabs, capwords
>
> Also zfill.
>
[Barry A. Warsaw]
> What do you think, are these important enough to add?
I think lack-of-surprise (gratuitous orthogonality <wink>) was the motive
here. If Guido could drop string functions in 2.0, which would he be happy
to forget? Give him a head start.
ljust and rjust were used often a long time ago, before the "%" sprintf-like
operator was introduced; don't think I've seen new code use them in years.
center was a nice convenience in the pre-HTML world, but probably never
speed-critical and easy to write yourself.
expandtabs is used frequently in IDLE and even pyclbr.py now. Curiously,
though, they almost never want the tab-expanded string, but rather its len.
capwords could become an absolute nightmare in a Unicode world <0.5 wink>.
> Maybe we can just drop in /F's implementation for these.
Sounds like A Plan to me. Wouldn't mourn the passing of the first three.
and-i-even-cried-at-my-father's-funeral<wink>-ly y'rs - tim
More information about the Python-Dev
mailing list