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 Antony.Lee
Recipients Antony.Lee
Date 2018-09-20.12:39:23
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
A quick check suggests that enum entries can be programmatically created by assigning to locals() in the Enum body:

   class E(Enum): locals()["a"] = 1
   E.a  # -> <E.a: 'a'>

However, using locals().update(...) doesn't, and silently does the wrong thing:

   class E(Enum): locals().update({"a": "a"})
   E.a  # -> 'a'

(Yes, in this simple case, I could just use the functional API (`E = Enum("E", [("a", "a")])`), but the above is simpler if I also want e.g. to define methods for the Enum.
Date User Action Args
2018-09-20 12:39:23Antony.Leesetrecipients: + Antony.Lee
2018-09-20 12:39:23Antony.Leesetmessageid: <>
2018-09-20 12:39:23Antony.Leelinkissue34750 messages
2018-09-20 12:39:23Antony.Leecreate