Brett Cannon <br...@python.org> added the comment:

> What I've never really got clear in my mind is how dotted names get handled.

Essentially:

1. Check if parent is imported; if not then import (working your way all the 
way back to the top if necessary)
2. Ask the sys.meta_path finders if they can handle the module
3. Use the loader from the spec
4. Add the imported module as an attribute on the parent

If you start from 
https://github.com/python/cpython/blob/master/Lib/importlib/__init__.py#L108 
you can see how it all works. The Python code is actually not that complicated, 
especially if you ignore all the old PEP 302 compatibility code 😉.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue43697>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to