Message411930
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". |
|
Date |
User |
Action |
Args |
2022-01-27 21:57:22 | Kodiologist | set | recipients:
+ Kodiologist |
2022-01-27 21:57:22 | Kodiologist | set | messageid: <1643320642.51.0.743138920796.issue46555@roundup.psfhosted.org> |
2022-01-27 21:57:22 | Kodiologist | link | issue46555 messages |
2022-01-27 21:57:22 | Kodiologist | create | |
|