New submission from Kodiologist <nonce0010...@arfer.net>:

I'm not sure if this is a bug, but it certainly surprised me. Most reserved 
words, when Unicode-mangled, as in "𝕕𝕖𝕗", act like ordinary identifiers (see 
e.g. bpo-46520). `True`, `False`, and `None` are weird in that Unicode-mangled 
versions of them refer to those same constants initially, but can take on their 
own identity as variables if assigned to:

    Python 3.9.7 (default, Sep 10 2021, 14:59:43) 
    [GCC 11.2.0] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> 𝕋𝕣𝕦𝕖
    True
    >>> True = 0
      File "<stdin>", line 1
        True = 0
        ^
    SyntaxError: cannot assign to True
    >>> 𝕋𝕣𝕦𝕖 = 0
    >>> True
    True
    >>> 𝕋𝕣𝕦𝕖
    0

I think that `𝕋𝕣𝕦𝕖 = 1` should probably be forbidden. The fact that `𝕋𝕣𝕦𝕖` 
doesn't always mean the same thing as `True` seems to break the rule in PEP 
3131 that "comparison of identifiers is based on NFKC".

----------
messages: 411930
nosy: Kodiologist
priority: normal
severity: normal
status: open
title: Unicode-mangled names refer inconsistently to constants
type: behavior
versions: Python 3.9

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

Reply via email to