STINNER Victor <vstin...@python.org> added the comment:

Another way to gather the list of Python modules: pydoc help("modules") uses 
pkgutil.walk_packages().

pydoc uses ModuleScanner which uses sys.builtin_module_names and 
pkgutil.walk_packages().

pkgutil.walk_packages() calls pkgutil.iter_modules() which iterates on 
sys.meta_path and sys.path, and calls iter_modules() on each importer.

For FileImporter, it iterates on os.listdir() on the importer path.

For zipimporter, it iterates on 
zipimport._zip_directory_cache[importer.archive].

----------

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

Reply via email to