string.py

Fredrik Lundh effbot at telia.com
Thu Feb 17 03:35:15 EST 2000


Barry A. Warsaw wrote:
>     FL> lazyness?
>
> Exactly right.  They weren't coded as C in stropmodule.c so they
> didn't make it in the first go 'round of string methods.  I think we
> later decided that they weren't used enough to care about.  Note that
> JPython's string objects don't have these methods either.

well, string.expandtabs is implemented in C these days
(for performance reasons).  and center/ljust/rjust are
really trivial to implement.

(so is capwords, but I'm not really sure about that
one).

anyway, you don't have to implement them yourself.
just nick the code from the unicode string type, and
change the character type to "char".

</F>





More information about the Python-list mailing list