Not x.islower() has different output than x.isupper() in list output...
Jussi Piitulainen
jussi.piitulainen at helsinki.fi
Tue May 3 10:49:48 EDT 2016
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.)
More information about the Python-list
mailing list