This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Kodiologist
Recipients BTaskaya, JelleZijlstra, Kodiologist, benjamin.peterson, pablogsal, sobolevn, terry.reedy
Date 2022-01-29.15:26:02
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1643469962.44.0.485458201403.issue46520@roundup.psfhosted.org>
In-reply-to
Content
(Hilariously, I couldn't post this comment on bugs.python.org due to some kind of Unicode bug ("Edit Error: 'utf8' codec can't decode bytes in position 208-210: invalid continuation byte"), so I've rendered "\U0001D555\U0001D556\U0001D557" as "DEF" in the below.)

Thanks for clarifying the terminology re: reserved words vs. keywords.

> The effect is the same as "globals()['DEF']=1" (which is the same as
> passing 'def' or anything else that normalizes to it) and that in
> turn allows ">>> DEF", which returns 1.

This doesn't quite seem to be the case, at least on Pythons 3.9 and 3.10:

    >>> globals()['DEF']=1
    >>> DEF
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    NameError: name 'def' is not defined
    >>> globals()['def']=1
    >>> DEF
    1

It looks the dictionary interface to `globals` doesn't normalize like the parser does.
History
Date User Action Args
2022-01-29 15:26:02Kodiologistsetrecipients: + Kodiologist, terry.reedy, benjamin.peterson, JelleZijlstra, pablogsal, BTaskaya, sobolevn
2022-01-29 15:26:02Kodiologistsetmessageid: <1643469962.44.0.485458201403.issue46520@roundup.psfhosted.org>
2022-01-29 15:26:02Kodiologistlinkissue46520 messages
2022-01-29 15:26:02Kodiologistcreate