Not x.islower() has different output than x.isupper() in list output...

Jussi Piitulainen jussi.piitulainen at helsinki.fi
Tue May 3 11:27:13 EDT 2016


DFS writes:

> On 5/3/2016 10:49 AM, Jussi Piitulainen wrote:
>> DFS writes:
>>
>>> On 5/3/2016 9:13 AM, Chris Angelico wrote:
>>
>>>> It doesn't invert, the way numeric negation does.
>>>
>>> What do you mean by 'case inverted'?
>>>
>>> It looks like it swaps the case correctly between upper and lower.
>>
>> There's letters that do not come in exact pairs of upper and lower case,
>> so _some_ swaps are not invertible: you swap twice and end up somewhere
>> else than your starting point.
>>
>> The "\N{ANSGTROM SIGN}" looks like the Swedish upper-case
>> a-with-ring-above but isn't the same character, yet Python swaps its
>> case to the actual lower-case a-with-ring above. It can't go back to
>> _both_ the Angstrom sign and the actual upper case letter.
>>
>> (Not sure why the sign is considered a cased letter at all.)
>
>
> Thanks for the explanation.
>
> Does that mean:
>
> lower(Å) != å ?
>
> and
>
> upper(å) != Å ?

It means "\N{ANGSTROM SIGN}" != "Å", yet both lower to "å", which then
uppers back to "Å" (U+00c5).

The Ångström sign (U+212b) looks like this: Å. Indistinguishable from Å
in the font that I'm seeing - for all I know, it's the same glyph.



More information about the Python-list mailing list