Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Something wrong with str.upper().lower() chain? #71795

Closed
magniff mannequin opened this issue Jul 24, 2016 · 5 comments
Closed

Something wrong with str.upper().lower() chain? #71795

magniff mannequin opened this issue Jul 24, 2016 · 5 comments
Labels
topic-unicode type-bug An unexpected behavior, bug, or error

Comments

@magniff
Copy link
Mannequin

magniff mannequin commented Jul 24, 2016

BPO 27608
Nosy @rhettinger, @vstinner, @ezio-melotti, @magniff

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2016-07-24.21:20:29.942>
created_at = <Date 2016-07-24.17:37:20.640>
labels = ['type-bug', 'invalid', 'expert-unicode']
title = 'Something wrong with str.upper().lower() chain?'
updated_at = <Date 2016-07-25.02:25:20.020>
user = 'https://github.com/magniff'

bugs.python.org fields:

activity = <Date 2016-07-25.02:25:20.020>
actor = 'abarry'
assignee = 'none'
closed = True
closed_date = <Date 2016-07-24.21:20:29.942>
closer = 'magniff'
components = ['Unicode']
creation = <Date 2016-07-24.17:37:20.640>
creator = 'magniff'
dependencies = []
files = []
hgrepos = []
issue_num = 27608
keywords = []
message_count = 5.0
messages = ['271174', '271175', '271176', '271177', '271182']
nosy_count = 4.0
nosy_names = ['rhettinger', 'vstinner', 'ezio.melotti', 'magniff']
pr_nums = []
priority = 'normal'
resolution = 'not a bug'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue27608'
versions = ['Python 3.4', 'Python 3.5', 'Python 3.6']

@magniff
Copy link
Mannequin Author

magniff mannequin commented Jul 24, 2016

For some reason 
>>> 'µ'.upper().lower() == 'µ'
False

@magniff magniff mannequin added topic-unicode type-bug An unexpected behavior, bug, or error labels Jul 24, 2016
@magniff
Copy link
Mannequin Author

magniff mannequin commented Jul 24, 2016

Note, that
>>> ord('µ')
181

there is another Mu like symbol chr(956), on which this code passes

@magniff
Copy link
Mannequin Author

magniff mannequin commented Jul 24, 2016

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.

@rhettinger
Copy link
Contributor

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

@magniff
Copy link
Mannequin Author

magniff mannequin commented Jul 24, 2016

Conclusion made: not a bug (not a python bug at least).

@magniff magniff mannequin closed this as completed Jul 24, 2016
@Vgr255 Vgr255 mannequin added the invalid label Jul 25, 2016
@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic-unicode type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

1 participant