On Thu, Sep 17, 2020 at 8:49 PM Chris Angelico <ros...@gmail.com> wrote:

> The only time you can safely mutate locals() is when you're at top
> level and it's the same as globals().
>

It's safe in class definitions, right? At least in CPython it seems to
work. I've done that a few times, most recently to dynamically generate
enum members.
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/MKREQCUJ32LMXARJEZM55V4SDAKWK4UJ/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to