This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Something wrong with str.upper().lower() chain?
Type: behavior Stage: resolved
Components: Unicode Versions: Python 3.6, Python 3.4, Python 3.5
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: ezio.melotti, magniff, rhettinger, vstinner
Priority: normal Keywords:

Created on 2016-07-24 17:37 by magniff, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (5)
msg271174 - (view) Author: Aleksandr Koshkin (magniff) Date: 2016-07-24 17:37
For some reason 
>>> 'µ'.upper().lower() == 'µ'
False
msg271175 - (view) Author: Aleksandr Koshkin (magniff) Date: 2016-07-24 17:46
Note, that
>>> ord('µ')
181

there is another Mu like symbol chr(956), on which this code passes
msg271176 - (view) Author: Aleksandr Koshkin (magniff) Date: 2016-07-24 18:14
So, yes, unicode table seems to be a bit inconsistent. In str documentation it worth to emphasize that something.upper().lower() in general not equals to something.
msg271177 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2016-07-24 18:25
Here is a little more detail on what is occurring:

>>> from unicodedata import *
>>> c = 'µ'
>>> for s in (c, c.lower(), c.upper(), c.lower().upper(), c.upper().lower()):
	print(s, ord(s), name(s), category(s))
	
µ 181 MICRO SIGN Ll
µ 181 MICRO SIGN Ll
Μ 924 GREEK CAPITAL LETTER MU Lu
Μ 924 GREEK CAPITAL LETTER MU Lu
μ 956 GREEK SMALL LETTER MU Ll
msg271182 - (view) Author: Aleksandr Koshkin (magniff) Date: 2016-07-24 21:20
Conclusion made: not a bug (not a python bug at least).
History
Date User Action Args
2022-04-11 14:58:34adminsetgithub: 71795
2016-07-25 02:25:20abarrysetresolution: not a bug
stage: resolved
2016-07-24 21:20:29magniffsetstatus: open -> closed

messages: + msg271182
2016-07-24 18:25:07rhettingersetnosy: + rhettinger
messages: + msg271177
2016-07-24 18:14:35magniffsetmessages: + msg271176
2016-07-24 17:46:27magniffsetmessages: + msg271175
2016-07-24 17:37:20magniffcreate