[Python-3000] Four new failing tests
Adam Olsen
rhamph at gmail.com
Sun Aug 12 21:39:23 CEST 2007
On 8/12/07, "Martin v. Löwis" <martin at v.loewis.de> wrote:
> > Wasn't unicodedata.ascii_letters suggested at one point (to eliminate
> > the string module), or was that my imagination?
>
> Not sure - I don't recall such a proposal.
>
> > IMO, if there is a need for unicode or locale letters, we should
> > provide a function to generate them as needed. It can be passed
> > directly to set or whatever datastructure is actually needed. We
> > shouldn't burden the startup cost with such a large datastructure
> > unless absolutely necessary (nor should we use a property to load it
> > when first needed; expensive to compute attribute and all that).
>
> Exactly my feelings. Still, people seem to like string.letters a lot,
> and I'm unsure as to why that is.
I think because it feels like the most direct, least obscured
approach. Calling ord() feels like a hack, re is overkill and
maligned for many reasons, and c.isalpha() would behave differently if
passed unicode instead of str.
Perhaps we should have a .isasciialpha() and document that as the
preferred alternative.
Looking over google codesearch results, I don't find myself enamored
with the existing string.letters usages. Most can be easily converted
to .isalpha/isalnum/isasciialpha/etc. What can't easily be converted
could be done using something else, and I don't think warrant use of
string.letters given its regular misusage. What's really frightening
is the tendency to use string.letters to build regular expressions.
--
Adam Olsen, aka Rhamphoryncus
More information about the Python-3000
mailing list