This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author brett.cannon
Recipients aronacher, brett.cannon, eric.snow, ncoghlan, rhettinger
Date 2014-05-05.13:54:13
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1399298054.2.0.547217947437.issue20383@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2014-05-05 13:54:14brett.cannonsetrecipients: + brett.cannon, rhettinger, ncoghlan, aronacher, eric.snow
2014-05-05 13:54:14brett.cannonsetmessageid: <1399298054.2.0.547217947437.issue20383@psf.upfronthosting.co.za>
2014-05-05 13:54:14brett.cannonlinkissue20383 messages
2014-05-05 13:54:13brett.cannoncreate