diff options
author | Victor Stinner <vstinner@python.org> | 2021-01-25 12:24:42 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-25 12:24:42 (GMT) |
commit | db584bdad32d81e42b71871077a8008036f5c048 (patch) | |
tree | ef018339067b08456b55a083547f9427b817f1b3 /Doc/library | |
parent | 879986d8a932c4524cb6ff822afc9537de16e28d (diff) | |
download | cpython-db584bdad32d81e42b71871077a8008036f5c048.zip cpython-db584bdad32d81e42b71871077a8008036f5c048.tar.gz cpython-db584bdad32d81e42b71871077a8008036f5c048.tar.bz2 |
bpo-42955: Add sys.modules_names (GH-24238)
Add sys.module_names, containing the list of the standard library
module names.
Diffstat (limited to 'Doc/library')
-rw-r--r-- | Doc/library/sys.rst | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst index 0f13adc..d536fc9 100644 --- a/Doc/library/sys.rst +++ b/Doc/library/sys.rst @@ -153,10 +153,12 @@ always available. .. data:: builtin_module_names - A tuple of strings giving the names of all modules that are compiled into this + A tuple of strings containing the names of all modules that are compiled into this Python interpreter. (This information is not available in any other way --- ``modules.keys()`` only lists the imported modules.) + See also the :attr:`sys.module_names` list. + .. function:: call_tracing(func, args) @@ -1060,6 +1062,24 @@ always available. This is still called as a fallback if a :data:`meta_path` entry doesn't have a :meth:`~importlib.abc.MetaPathFinder.find_spec` method. +.. data:: module_names + + A frozenset of strings containing the names of standard library modules. + + It is the same on all platforms. Modules which are not available on + some platforms and modules disabled at Python build are also listed. + All module kinds are listed: pure Python, built-in, frozen and extension + modules. Test modules are excluded. + + For packages, only sub-packages are listed, not sub-modules. For example, + ``concurrent`` package and ``concurrent.futures`` sub-package are listed, + but not ``concurrent.futures.base`` sub-module. + + See also the :attr:`sys.builtin_module_names` list. + + .. versionchanged:: 3.10 + + .. data:: modules This is a dictionary that maps module names to modules which have already been |