[Python-Dev] Re: String module

M.-A. Lemburg mal@lemburg.com
Wed, 29 May 2002 22:01:10 +0200

Guido van Rossum wrote:
>>FYI, Unicode has these:
>>     {"islower", (PyCFunction) unicode_islower, METH_NOARGS, islower__doc__},
>>     {"isupper", (PyCFunction) unicode_isupper, METH_NOARGS, isupper__doc__},
>>     {"istitle", (PyCFunction) unicode_istitle, METH_NOARGS, istitle__doc__},
>>     {"isspace", (PyCFunction) unicode_isspace, METH_NOARGS, isspace__doc__},
>>     {"isdecimal", (PyCFunction) unicode_isdecimal, METH_NOARGS, isdecimal__doc__},
>>     {"isdigit", (PyCFunction) unicode_isdigit, METH_NOARGS, isdigit__doc__},
>>     {"isnumeric", (PyCFunction) unicode_isnumeric, METH_NOARGS, isnumeric__doc__},
>>     {"isalpha", (PyCFunction) unicode_isalpha, METH_NOARGS, isalpha__doc__},
>>     {"isalnum", (PyCFunction) unicode_isalnum, METH_NOARGS, isalnum__doc__},
>>Note that unlike for ASCII strings, the characters all have
>>defined categories.
>>Strings miss a few of these:
>>	{"islower", (PyCFunction)string_islower, METH_NOARGS, islower__doc__},
>>	{"isupper", (PyCFunction)string_isupper, METH_NOARGS, isupper__doc__},
>>	{"isspace", (PyCFunction)string_isspace, METH_NOARGS, isspace__doc__},
>>	{"isdigit", (PyCFunction)string_isdigit, METH_NOARGS, isdigit__doc__},
>>	{"istitle", (PyCFunction)string_istitle, METH_NOARGS, istitle__doc__},
>>	{"isalpha", (PyCFunction)string_isalpha, METH_NOARGS, isalpha__doc__},
>>	{"isalnum", (PyCFunction)string_isalnum, METH_NOARGS, isalnum__doc__},
> I think all of the unicode methods should be added to 8-bit strings,
> even if they are just aliases for others (what's title case applied to
> Latin-1?  I suppose same as upper case?).

 >>> for i in range(256):
...     assert unichr(i).istitle() == unichr(i).isupper()

Seems so :-)

Marc-Andre Lemburg
CEO eGenix.com Software GmbH
Company & Consulting:                           http://www.egenix.com/
Python Software:                   http://www.egenix.com/files/python/
Meet us at EuroPython 2002:                 http://www.europython.org/