[Python-Dev] String module
Raymond Hettinger
python@rcn.com
Wed, 29 May 2002 13:28:27 -0400
From: "Guido van Rossum" <guido@python.org>
> > What shall we Silently Deprecate?
> >
> > string module
>
> Yes, after providing substitutes.
I commented on the substitutes patch, www.python.org/sf/561832, but thought
it would be better to kick the idea around here on Py-dev.
Instead of making direct substitutes for the character lists, I propose we
take advantage of the opportunity and provide them as mappings rather than
strings. That way, we can get O(1) behavior instead of O(n) behavior for
code like: if c in str.printable: c='*'. If someone needs to know the
contents, they can run str.printable.keys(). Also, because the dictionary
is mutable, someone can (at runtime) expand or contract the definitions:
str.whitespace.append('_').
Raymond Hettinger