<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 15 November 2017 at 06:34, Neil Schemenauer <span dir="ltr"><<a href="mailto:nas-python-ideas@arctrix.com" target="_blank">nas-python-ideas@arctrix.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
So, what is the purpose of all this trouble?<br>
<br>
- I believe quite a lot of Python internals can be simpler. For<br>
example, importlib is complicated by the fact that a dict is<br>
passed around when most of the logic would prefer to have the<br>
module. Grubbing in sys.modules to lookup the module object is<br>
ugly. The expression "exec(code, module)" is elegant to me.<br></blockquote><div><br></div>I like the idea in principle, but highlighting a particular backwards compatibility pain point: one of the complications in importlib is that we promise to keep the "sys.modules[__name__] = some_other_object" idiom working. That means the need to do that check exists regardless of whether importlib is passing the module itself around, or the module's dict.<br></div><div class="gmail_quote"><br></div><div class="gmail_quote">Cheers,</div><div class="gmail_quote">Nick.<br clear="all"></div><br>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">Nick Coghlan | <a href="mailto:ncoghlan@gmail.com" target="_blank">ncoghlan@gmail.com</a> | Brisbane, Australia</div>
</div></div>