New submission from Jim Jewett <jimjjew...@gmail.com>:

Python identifiers are in NFKC form; string method .isidentifier() returns true 
on strings that are not in that form.  In some contexts, these non-canonical 
strings will be replaced with their NFKC equivalent, but in other contexts 
(such as the builtins hasattr, getattr, delattr) they will not.


>>> cha=chr(170)
>>> cha
'ª'

>>> cha.isidentifier()
True

>>> uc.normalize("NFKC", cha)
'a'

>>> obj.ª = 5
>>> hasattr(obj, "ª")
False
>>> obj.a
5

----------
components: Unicode
messages: 151597
nosy: Jim.Jewett, ezio.melotti
priority: normal
severity: normal
status: open
title: misleading return from isidentifier

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue13821>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to