<div dir="ltr"><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, May 30, 2019 at 4:28 PM Greg Ewing <<a href="mailto:greg.ewing@canterbury.ac.nz">greg.ewing@canterbury.ac.nz</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Nick Coghlan wrote:<br>
> So for me, getting rid of write backs via exec and "import *" was a<br>
> matter of "Yay, we finally closed those unfortunate loopholes" rather<br>
> than being any kind of regrettable necessity.<br>
<br>
If that were the reasoning, the principled thing to do would be<br>
to raise an exception if an eval or exec tries to write to a<br>
local, rather than mostly ignore it.<br>
<br>
In any case, I don't really agree with that philosophy. Python<br>
is at its essence a dynamic language. Things like JIT and static<br>
type analysis are only possible to the extent that you refrain<br>
from using some of its dynamic features. Removing features<br>
entirely just because they *can* interfere with these things goes<br>
against the spirit of the language, IMO.<br></blockquote><div><br></div><div>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()).<br></div><div> </div></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>--Guido van Rossum (<a href="http://python.org/~guido" target="_blank">python.org/~guido</a>)</div><div><i style="font-family:Arial,Helvetica,sans-serif;font-size:small;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);color:rgb(136,136,136)"><span>Pronouns</span>: he/him/his </i><a href="http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-change-the-world/" style="color:rgb(17,85,204);font-family:Arial,Helvetica,sans-serif;font-size:small;font-style:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255)" target="_blank"><i>(why is my <span>pronoun</span> here?)</i></a></div></div></div></div>