I'd also love to see string constants implemented some day too
(like str.whitespace and str.ascii_letters).
You mean like the "string" module provides? :)
>>import string
print '\n'.join(["%s -%s" % (s, repr(eval('string.%s' %
s))) for s in dir(string) if isinstance(eval('string.%s' % s),
basestring) and not s.startswith('_')])
ascii_letters ->
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVW XYZ'
ascii_lowercase -'abcdefghijklmnopqrstuvwxyz'
ascii_uppercase -'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
digits -'0123456789'
hexdigits -'0123456789abcdefABCDEF'
letters -'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVW XYZ'
lowercase -'abcdefghijklmnopqrstuvwxyz'
octdigits -'01234567'
printable ->
'0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLM NOPQRSTUVWXYZ!"#$
%&\'()*+,-./:;<=>?@[\\]^_`{|}~ \t\n\r\x0b\x0c'
punctuation -'!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~'
uppercase -'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
whitespace -'\t\n\x0b\x0c\r '
>>string.lowercase
'abcdefghijklmnopqrstuvwxyz'
(you mentioned liking list comprehensions, so that ugly hack of a
one-liner extracts all the string properties of the "string"
module that don't begin with an underscore)
-tkc