[Python-Dev] other "magic strings" issues

Alex Martelli aleaxit at yahoo.com
Fri Nov 7 12:30:55 EST 2003


On Friday 07 November 2003 06:26 pm, Barry Warsaw wrote:
> On Fri, 2003-11-07 at 12:05, Guido van Rossum wrote:
> > Yes, that would be good.  Is there anything besides maketrans() in the
> > string module worth saving?  (IMO letters and digits etc. are not --
> > you can use s.isletter() etc. for that.)
>
> I'm not following, are you saying we don't need string.ascii_letters and
> friends any more?

I think we do, but I'd rather access them as str.ascii_letters myself.  Or
maybe we could use just letters, lowercase and uppercase as attribute
names, implying the ascii_ -- people needing nonasciis might then still
need to "import string", which in itself might be OK, but... that might be
a bit too confusing overall.

Anyway, I do have code that e.g. does "for c in string.ascii_lowercase: ...", 
and that is not as handily done with just the .islowercase method...


Alex




More information about the Python-Dev mailing list