[Python-Dev] deprecating string module?
Martin v. Loewis
martin@v.loewis.de
30 May 2002 08:59:15 +0200
Guido van Rossum <guido@python.org> writes:
> > > Also, the data objects obviously have to be put somewhere. Before
> > > doing any of this, we need to decide where this stuff belongs. I
> > > doubt the technical effort involved will be too challenging.
> >
> > So we don't need to make a decision today, right? We can delay that
> > until those easy problems are solved.
>
> What about my proposal to get rid of the data objects and add a few
> isxxx() methods instead?
That's a good thing to do, I agree.
> 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.
Regards,
Martin