[issue21235] importlib's spec module create algorithm is not exposed

Eric Snow report at bugs.python.org
Mon May 26 20:45:04 CEST 2014


Eric Snow added the comment:

I'm just considering current usage:

  mod = loader.load_module(name)

becomes:

  spec = spec_from_loader(name, loader)
  mod = load(spec)

vs.

  mod = load(name, loader=loader)

I guess I'm torn.  I like how the former forces you to consider specs when dealing with the import system.  On the other hand, I don't want it to be annoying to have to move to this brave new world (that's exactly why we toned down the deprecations).  And on the third hand, perhaps it would be annoying to just a handful of people so we shouldn't sweat it.

So if we end up simplifying, load() could look like this:

def load(spec):  # or "load_from_spec"
    return _SpecMethods(spec).load()

It already takes care of everything we need, including the import lock stuff.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21235>
_______________________________________


More information about the Python-bugs-list mailing list