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

DFS nospam at dfs.com
Tue May 3 11:12:50 EDT 2016


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(å) != Å ?





More information about the Python-list mailing list