[docs] [issue21108] Add examples for importlib in doc

Brett Cannon report at bugs.python.org
Mon Mar 31 17:54:09 CEST 2014

Brett Cannon added the comment:

While I'm totally happy to add examples on usage, it is probably best to put them at the end of the class-level docs instead of trailing after the last method of the class. That way someone reading about what the class does can also see examples of how to use it.

Another point is that SourceFileLoader.load_module() is documented as deprecated as of Python 3.4 and so promoting it in an example is not good. Now that module creation has been broken out separately this "create a module from a file path" approach is becoming more and more difficult. If we care to continue to support this use case we will probably need to come up with a function(s) to make it easier and toss something up on PyPI that is Python 2.7-3.5 compatible.

versions: +Python 3.5

Python tracker <report at bugs.python.org>

More information about the docs mailing list