[issue41542] module `__all__` cannot detect function name with `φ`
Seth Woodworth added the comment: As described in PEP3131, unicode identifiers are normalized via NFKC before being added to the globals, and presumably __all__ as in your example. You can see what python _did_ add via unicodedata.normalize('NFKC', 'ϕ') which returns 'φ' [ins] In [8]: bytes('φ', 'utf8') Out[8]: b'\xcf\x86' [ins] In [9]: bytes('ϕ', 'utf8') Out[9]: b'\xcf\x95' The normalized version of Phi, I _can_ add to my globals: globals()['φ'] = 'foo' -- nosy: +sethwoodworth ___ Python tracker <https://bugs.python.org/issue41542> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41542] module `__all__` cannot detect function name with `φ`
Seth Woodworth added the comment: I don't think it is worth throwing a warning. This might be the desired, or at least allowed, behavior. I'm relying on the behavior in a toy library I'm working on. -- ___ Python tracker <https://bugs.python.org/issue41542> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41542] module `__all__` cannot detect function name with `φ`
Seth Woodworth added the comment: @Steven, I'm exploring what unicode code points can be used as valid starting characters for identifiers. I'm looping over the code point ranges with the XID_START property and attempting to add them to globals() to see if they maintain the same representation. Now that I think about it, I could just check if unicode.normalize('NFKC', character) == character before adding it, and I wouldn't see a warning if one existed. -- ___ Python tracker <https://bugs.python.org/issue41542> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com