On Thu, Aug 26, 2021 at 2:40 AM Nick Coghlan <ncogh...@gmail.com> wrote:

> [snip]
> An unrelated issue that came up while working on that update is
> something that affects both PEPs: calling "proxy.clear()" is *super
> weird* if we make it work the same way as PyEval_LocalsToFast() works
> today. Specifically, it can reach out and clear cells in outer frames,
> including the __class__ cell used by zero-arg super(). I can't see
> anyone being super upset if we decide to change that and say that
> proxy.clear() leaves free variables alone, and only clears local
> variables and cells owned by that particular frame.
>

That would be another weird corner case. The only exception I would make
would be for __class__, which is only a cell for implementation
convenience. But why would anyone write proxy.clear()? That would be like
deleting all local variables -- what would be the use case for that? I
guess to start over with a computation. But there are better ways to do
that. So let's not worry too much about preventing the user from shooting
themselves in the foot -- surely at the global level, "globals().clear()"
will do weird shit too. :-)

-- 
--Guido van Rossum (python.org/~guido)
*Pronouns: he/him **(why is my pronoun here?)*
<http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-change-the-world/>
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/OTTSADTLKEC4LTYRULLY7P46QK36IMVG/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to