[Python-ideas] lazy import via __future__ or compiler analysis

Eric Snow ericsnowcurrently at gmail.com
Tue Sep 12 22:32:40 EDT 2017


On Sep 11, 2017 2:32 PM, "Neil Schemenauer" <nas-python-ideas at arctrix.com>
wrote:

On 2017-09-11, Neil Schemenauer wrote:
> A module can be a singleton instance of a singleton ModuleType
> instance.

Maybe more accurate to say each module would have its own unique
__class__ associated with it.  So, you can add properties to the
class without affecting other modules.  For backwards compatibility,
we can create anonymous modules as needed if people are passing
'dict' objects to the legacy API.


FYI, you should be able to try this out using a custom loader the
implements a create_module() method.  See importlib.abc.Finder.

-eric
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20170912/a857b612/attachment.html>


More information about the Python-ideas mailing list