On Sun, Dec 4, 2022, 2:08 PM Chris Angelico <ros...@gmail.com> wrote:

> You're not the first to try to use globals() for this, but it means that
> the context manager works ONLY at top-level.


True. I know that. But if you're inside a function, you already have scope
containment, so the issue feels like "so what?"

But doh! I always forget about which way the locals() / globals()
mutability thing goes. A regular del without exec is better, of course.
_______________________________________________
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/V7ECRYFAH6WA532WAGX6NH3BWZHVU6UC/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to