[Python-Dev] PEP 362 Third Revision

Terry Reedy tjreedy at udel.edu
Thu Jun 14 22:27:23 CEST 2012


On 6/14/2012 3:46 PM, Ethan Furman wrote:
> Antoine Pitrou wrote:

>> Also, the "is_*" attributes are misleading: it looks like they are
>> orthogonal but only one of them can be true at any time.
>
> This is no different from what we have with strings now:
>
> --> 'aA'.islower()
> False
> --> 'aA'.isupper()
> False
> --> 'a'.islower()
> True
> --> 'A'.isupper()
> True

The analogy does not hold. These are not attributes. They are methods 
that scan the attributes of individual characters in the string. Also, 
for many alphabets, characters are both upper and lower case, unless you 
prefer no case or uncased. Then there is also titlecase.  Of course, 
multiple character strings can be mixed case. So str.casekind does not 
make much sense. So your example convinces me even more that 'kind' is 
the way to go ;-).

---
Letter upper/lower case, if they follow the unicode definition below, 
are primarily derived from 'Lu' and 'Ll', which are two of about 30 
possible general categories (one attribute). But they also use 
Other_Uppercase and Other_Lowercase.
'''
DerivedCoreProperties.txt
Lowercase 	B 	I 	Characters with the Lowercase property. For more 
information, see Chapter 4, Character Properties in [Unicode].
Generated from: Ll + Other_Lowercase

Uppercase 	B 	I 	Characters with the Uppercase property. For more 
information, see Chapter 4, Character Properties in [Unicode].
Generated from: Lu + Other_Uppercase
'''
But these are all implementation details depending on the particular 
organization of the unicode character database. Defining cross-alphabet 
'character' properties is a non-trivial endeavor, not at all like 
argument kind.

-- 
Terry Jan Reedy



More information about the Python-Dev mailing list