On 15 November 2017 at 06:34, Neil Schemenauer <nas-python-id...@arctrix.com
> wrote:

> So, what is the purpose of all this trouble?
>
> - I believe quite a lot of Python internals can be simpler.  For
>   example, importlib is complicated by the fact that a dict is
>   passed around when most of the logic would prefer to have the
>   module.  Grubbing in sys.modules to lookup the module object is
>   ugly.  The expression "exec(code, module)" is elegant to me.
>

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.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncogh...@gmail.com   |   Brisbane, Australia
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to