Author vstinner
Recipients serhiy.storchaka, vstinner
Date 2021-01-18.15:06:38
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1610982398.87.0.942289652697.issue42955@roundup.psfhosted.org>
In-reply-to
Content
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].
History
Date User Action Args
2021-01-18 15:06:38vstinnersetrecipients: + vstinner, serhiy.storchaka
2021-01-18 15:06:38vstinnersetmessageid: <1610982398.87.0.942289652697.issue42955@roundup.psfhosted.org>
2021-01-18 15:06:38vstinnerlinkissue42955 messages
2021-01-18 15:06:38vstinnercreate