When does using swapcase twice not return an identical answer?

This is the case when multiple letters are lower cases of the same letter.

For example, the micro character µ (U+00B5) and the mu character μ (U+03BC):

>>> u'\xb5'.swapcase()
u'\u039c'
>>> u'\u03bc'.swapcase()
u'\u039c'

The two are different characters, but their uppercase counterparts are the same. This means that when str.swapcase() is applied, they return the same character. However, doing this again can’t (and won’t) return both letters.

>>> u'\xb5'.swapcase().swapcase()
u'\u03bc'

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)