[Python-Dev] other "magic strings" issues

Raymond Hettinger python at rcn.com
Fri Nov 7 13:25:58 EST 2003

> Hm, I'd forgotten about ascii_letters.  It would make a beautiful
> class attribute of str.

The problem with ascii_letters is that it is not constant.  Depending on
the startup, it can optionally replace the usual definition with that
provided by strop.lowercase.

> I *do* think that we don't need string.letters -- the only use for it
> I've seen is checking if a character is in that string, and
> c.isletter() is faster.  But if someone has a use case for it that
> isn't argued away, I'd be okay with seeing it reincarnated as a class
> attribute of str too.

I had C coded a patch for a whole group of str.isSomething tests.  The
only thing that held it up was my not finding time to figure out how to
exactly the same thing for Unicode objects.  Maybe someone can pick-up
the patch:



More information about the Python-Dev mailing list