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

Ethan Furman report at bugs.python.org
Sat Sep 12 20:02:05 EDT 2020


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

Antony,

My apologies for the delay.

What I would like to see is a real example of how you would use this new feature if it were implemented.  I'm guessing it would look something like:

    class MyEnum(Enum):

        locals.update(*some magic here*)

        def a_method(self):
            ...

Am I right?  If yes, what does *some magic here* look like?  If no, what would your code actually look like?

----------

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


More information about the Python-bugs-list mailing list