[Python-Dev] [PEP 558] thinking through locals() semantics (original) (raw)

Greg Ewing greg.ewing at canterbury.ac.nz
Thu May 30 19:26:03 EDT 2019


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.

-- Greg



More information about the Python-Dev mailing list