[Python-Dev] other "magic strings" issues

Fred L. Drake, Jr. fdrake at acm.org
Fri Nov 7 18:10:51 EST 2003


Guido van Rossum writes:
 > In the end it would be a module containing 4 constants and one
 > function.  I'd rather consolidate all that elsewhere.

Frankly, that doesn't bother me, especially given that they've always
been in the string module.  But I count more than 4 constants that
should be kept:

    ascii_letters
    ascii_lowercase
    ascii_uppercase
    digits
    hexdigits
    octdigits
    whitespace

All of these could reasonably live on both str and unicode if that's
not considered pollution.  But if they live in a module, there's no
reason not to keep string around for that purpose.

(I don't object to making them class attributes; I object to creating
a new module for them.)


  -Fred

-- 
Fred L. Drake, Jr.  <fdrake at acm.org>
PythonLabs at Zope Corporation



More information about the Python-Dev mailing list