[issue34750] locals().update doesn't work in Enum body, even though direct assignment to locals() does

Ethan Furman report at bugs.python.org
Thu Sep 20 10:28:05 EDT 2018


Ethan Furman <ethan at stoneleaf.us> added the comment:

`locals()` returns the dictionary being used (an _EnumDict) and direct assignment uses the `__setitem__` method, which has been overridden -- and it is the only one; so `update()`, etc., still have normal dict meanings and not Enum ones.

Next step:  compile list of all methods that _EnumDict should override.

Or just say it's not supported.

Antony, can you give a more detailed use-case?  Meaning an actual example, please.

----------
assignee:  -> ethan.furman
nosy: +ethan.furman
versions: +Python 3.8 -Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34750>
_______________________________________


More information about the Python-bugs-list mailing list