Message217925
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. |
|
Date |
User |
Action |
Args |
2014-05-05 13:54:14 | brett.cannon | set | recipients:
+ brett.cannon, rhettinger, ncoghlan, aronacher, eric.snow |
2014-05-05 13:54:14 | brett.cannon | set | messageid: <1399298054.2.0.547217947437.issue20383@psf.upfronthosting.co.za> |
2014-05-05 13:54:14 | brett.cannon | link | issue20383 messages |
2014-05-05 13:54:13 | brett.cannon | create | |
|