[issue13821] misleading return from isidentifier

Benjamin Peterson report at bugs.python.org
Thu Jan 19 02:06:31 CET 2012


Benjamin Peterson <benjamin at python.org> added the comment:

2012/1/18 Jim Jewett <report at bugs.python.org>:
>
> Jim Jewett <jimjjewett at gmail.com> added the comment:
>
> My preference would be for non_NFKC.isidentifier() to return False

It *is* an identifier, though. Python will happily accept it.

>
> It *may* be worth adding an asidentifier() method that returns either False or the canonicalized string that should be used instead.
>
> At a minimum, the documentation (including docstring) should warn that the method doesn't check for NFKC form, and that if the input is not ASCII, the caller should first ensure this by calling str1=unicodedata.normalize("NFKC", str1)

Sounds fine to me.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13821>
_______________________________________


More information about the Python-bugs-list mailing list