Advanced Python
Q76 / 101

How does Python's import system find and load modules?

Correct! Well done.

Incorrect.

The correct answer is B) The importer searches sys.modules first, then uses finders in sys.meta_path, then loaders to execute module code

B

Correct Answer

The importer searches sys.modules first, then uses finders in sys.meta_path, then loaders to execute module code

Explanation

import triggers sys.meta_path finders (PathFinder, etc.). If the module is already in sys.modules it's returned immediately. Otherwise, a loader executes the module file.

Progress
76/101