[issue21436] Consider leaving importlib.abc.Loader.load_module()

Brett Cannon report at bugs.python.org
Mon May 5 15:46:59 CEST 2014


Brett Cannon added the comment:

So it's not quite as bad as you think as SourceFileLoader.load_module() doesn't need an argument (I've opened http://bugs.python.org/issue21438 to fix the documentation). Admittedly it is a longer command than imp.load_source() to type, but there is no extra information required or a necessity that you break the command up into multiple lines.

Plus imp.load_source() is just plain bad. The reason the imp module is deprecated in Python 3.4 is because it does not expose the low-level details of import in a way that makes any sense since Python 2.3 (and yes, I meant to write 2.3 instead of 3.3; the problem has persisted _that_ long).

That being said, talks are just starting to consider undoing the documented deprecation of load_module() such that you can continue to use that as a substitute for imp.load_source()/imp.load_module().

I'm going to leave this bug open, hijack its title, and refocus this as to consider leaving importlib.abc.Loader.load_module() in importlib as the all-powerful fallback API which also simplifies transitioning from imp.

----------
assignee:  -> brett.cannon
nosy: +ncoghlan
title: bring back importlib.load_source() et al. -> Consider leaving importlib.abc.Loader.load_module()

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


More information about the Python-bugs-list mailing list