Slide 3
Slide 3 text
How does importing work in Python?
- If the named module is not found in sys.modules, then Python’s import protocol
is invoked to find and load the module.
- This protocol consists of two conceptual objects, finders and loaders.
- A finder’s job is to determine whether it can find the named module using whatever strategy it
knows about.
- Loader’s job is to load the module (execute the code in the module and register the globals)
- Objects that implement both of these interfaces are referred to as importers.