[Python-Dev] deprecating string module?

Guido van Rossum guido@python.org
Thu, 30 May 2002 08:15:40 -0400


> > I don't think that the data objects have any other function except
> > for membership testing, and a method can be faster.
> 
> That is not true. Asking google for "string.letters" brings, as the
> first hit,
> 
> non_letters = string.translate(norm, norm, string.letters) 
> 
> I also found
> 
> random.choice(string.lowercase[:26] + string.uppercase[:26] + string.digits)
> 
> This is, of course, nonsense, since it tries to "unlocalize"
> string.lowercase, where a string literal would have been
> better.
> 
> I'm sure people have found other uses for these constants.

That just shows we have to be very slow before we remove the string
module.  I think "not until 3.0" is slow enough.  These "use cases"
don't convince me that there's a legitimate use case for
string.letters etc. that the methods don't cover.

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