Brett Cannon added the comment:

My current thinking on this it to introduce in importlib.util:

  def module_from_spec(spec, module=None):
    """Create/initialize a module based on the provided spec.

    If a module is provided then spec.loader.create_module()
    will not be consulted.
    """

This serves two purposes. One is that it abstracts the loader.create_module() 
dance out so that's no longer a worry. But more crucially it also means that if 
you have the function create the module for you then it will be returned with 
all of its attributes set without having to worry about forgetting that step. 
The module argument is just for convenience in those instances where you truly 
only want to override the module creation dance for some reason and really just 
want the attribute setting bit.

----------
nosy: +aronacher

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

Reply via email to