[Python-Dev] String module

Guido van Rossum guido@python.org
Wed, 29 May 2002 21:22:49 -0400

> I like the read-only dictionary better than the boolean test
> methods.  It minimizes the effort in upgrading existing code of the
> form:
> for c in string.lowercase:
>     do something
> if c in string.lowercase:
>     do something
> I can global search/replace string.lowercase with str.lower in
> dictionary form and everything will run fine (and faster too).

I think this is not enough motivation.  We have a whole slew of test
methods already.  Also the dict approach doesn't scale to Unicode (the
dicts would have to be enormous) while the test method approach easily
scales to Unicode (it's already implemented that way there).

> Also, I like the mapping because provides a way to see the
> membership.  With the string form or the mapping form, it's easy to
> find-out exactly what is defined as whitespace.  If there is a C
> coded boolean test, I have to filter the whole alphabet or look it
> up in the docs.

A very minor advantage indeed -- and again one that doesn't scale to

> If we can get some agreement that this is the way to go, I can work
> with the OP on a revised patch so we get the string module silently
> deprecated.

Maybe you can do a patch for isxxx() methods instead?

--Guido van Rossum (home page: http://www.python.org/~guido/)