Brett Cannon added the comment:

The inspiration was that I realized there was no technical reason to have it on 
InspectLoader. Past that there was my thinking of trying to come up with a 
source_to_module() method on importlib.abc.Loader which would do the right 
thing with create_module() and init_module_attrs() such that replicating 
imp.load_module() would be something like::

  loader = importlib.machinery.SourceLoader  # or something
  with open('file.py') as file:
    module = loader.source_to_module(file.read(), location='file.py')

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue21156>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to