[Python-Dev] [PEP 558] thinking through locals() semantics (original) (raw)
Guido van Rossum guido at python.org
Thu May 30 20:22:57 EDT 2019
- Previous message (by thread): [Python-Dev] [PEP 558] thinking through locals() semantics
- Next message (by thread): [Python-Dev] [PEP 558] thinking through locals() semantics
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Thu, May 30, 2019 at 4:28 PM Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
Nick Coghlan wrote: > So for me, getting rid of write backs via exec and "import *" was a > matter of "Yay, we finally closed those unfortunate loopholes" rather > than being any kind of regrettable necessity.
If that were the reasoning, the principled thing to do would be to raise an exception if an eval or exec tries to write to a local, rather than mostly ignore it. In any case, I don't really agree with that philosophy. Python is at its essence a dynamic language. Things like JIT and static type analysis are only possible to the extent that you refrain from using some of its dynamic features. Removing features entirely just because they can interfere with these things goes against the spirit of the language, IMO.
Right. And static analysis should also be able to detect most uses of locals() in a frame. I believe I've heard of some alternate Python implementations that detect usage of some functions to disable some optimizations (IIRC IronPython did this to sys._getframe()).
-- --Guido van Rossum (python.org/~guido) *Pronouns: he/him/his **(why is my pronoun here?)* <http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-change-the-world/> -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20190530/401ea924/attachment.html>
- Previous message (by thread): [Python-Dev] [PEP 558] thinking through locals() semantics
- Next message (by thread): [Python-Dev] [PEP 558] thinking through locals() semantics
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]