[New-bugs-announce] [issue13821] misleading return from isidentifier

Jim Jewett report at bugs.python.org
Thu Jan 19 01:54:19 CET 2012

New submission from Jim Jewett <jimjjewett at 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()

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

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

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

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list