[Python-Dev] Adding Unicode methods to string objects

M.-A. Lemburg mal@lemburg.com
Tue, 07 Mar 2000 15:38:09 +0100


Fredrik Lundh wrote:
> 
> > Unicode objects      string objects
> > expandtabs
> 
> yes.
> 
> I'm pretty sure there's "expandtabs" code in the
> strop module.  maybe barry missed it?
> 
> > center
> > ljust
> > rjust
> 
> probably.
> 
> the implementation is trivial, and ljust/rjust are
> somewhat useful, so you might as well add them
> all (just cut and paste from the unicode class).
> 
> what about rguido and lguido, btw?

Ooops, forgot those, thanks :-)
 
> > zfill
> 
> no.

Why not ?

Since the string implementation had all of the above
marked as TBD, I added all four.

What about the other new methods (.isXXX() and .splitlines()) ?

.isXXX() are mostly needed due to the extended character
properties in Unicode. They would be new to the string object
world.

.splitlines() is Unicode aware and also treats CR/LF
combinations across platforms:

S.splitlines([maxsplit]]) -> list of strings

Return a list of the lines in S, breaking at line boundaries.
If maxsplit is given, at most maxsplit are done. Line breaks are not
included in the resulting list.

-- 
Marc-Andre Lemburg
______________________________________________________________________
Business:                                      http://www.lemburg.com/
Python Pages:                           http://www.lemburg.com/python/