Not x.islower() Versus x.isupper Output Results
Steven D'Aprano
steve at pearwood.info
Fri Apr 29 21:31:23 EDT 2016
On Sat, 30 Apr 2016 11:14 am, Christopher Reimer wrote:
> Shouldn't the results between 'not x.islower()' and 'x.isupper()' be
> identical?
Of course not.
py> "2 #".islower(), "2 #".isupper()
(False, False)
py> not "2 #".islower(), "2 #".isupper()
(True, False)
"Is Lower" versus "Is Upper" is not a dichotomy. There are:
- lowercase characters, like "abc"
- uppercase characters, like "ABC"
- characters which are neither lowercase nor uppercase, like "2 #"
In unicode, there are also:
- titlecase characters, like "DžLjῼ"
If those characters don't show up for you, they are:
U+01C5 LATIN CAPITAL LETTER D WITH SMALL LETTER Z WITH CARON
U+01C8 LATIN CAPITAL LETTER L WITH SMALL LETTER J
U+1FFC GREEK CAPITAL LETTER OMEGA WITH PROSGEGRAMMENI
So not islower() is very different from isupper.
--
Steven
More information about the Python-list
mailing list