Wishlist: string attributes

Alex Martelli aleax at aleax.it
Thu Mar 27 01:03:49 CET 2003

Raymond Hettinger wrote:

>> So, in practice, I *DO* still need a string of "all letters", "all
>> printable characters", and the like, for purposes such as this one --
>> even though I had a complete complement of .isXXX methods too.  Guess
>> I can always ''.join(filter(str.isXXX, allchars)), but I'd much
>> rather have the needed strings ready in the str class as I now have
>> them in the string module... is there any technical impediment to
>> supplying them?
> The character strings could be provided if needed.

I think it would be useful to have them.

> If they are fixed, it may make sense to add them.
> For functions like, isalpha(), the answer is locale
> dependent.

Yes, but string.lowercase &c adjust to that today:

>>> import string
>>> print string.lowercase
>>> import locale
>>> locale.setlocale(locale.LC_ALL,'it')
>>> print string.lowercase

so why couldn't class str provide the same adjusted
strings?  (The fact that most of these are NOT Italian
lowercase letters, and some, like that 1/2 symbol,
seem not to be lowercase letters at all, seems to be
quite a different issue [maybe related to my system's
settings -- haven't checked]).


More information about the Python-list mailing list