Hello,

On 22/02/19 5:40 AM, ast wrote:
Is it normal to have 151 entries in dictionary sys.modules
just after starting IDLE or something goes wrong ?
 >>> import sys
 >>> len(sys.modules)
151

I don't use Idle. Written in python, doesn't it require various packages to run before it even talks to you, eg tkinter? Thus am not sure if they are also being counted. However:-

After firing-up Python 3.7 from the cmdLN, my system reported only 60.

Remember also, that the sys Run-time service is described as "System-specific parameters and functions", which will account for (some) differences by itself.


Most of common modules seems to be already there,
os, itertools, random ....
I thought that sys.modules was containing loaded modules
with import command only.

Not quite true! Whereas the manual says
<<<
sys.modules This is a dictionary that maps module names to modules which have already been loaded.
>>>

also remember that import is not the only way modules are "loaded"! Built-in types (etc) are/must be loaded as part of python, otherwise nothing would work, eg float, int, list, contextlib, collections, functools, ... This is the modular/boot-strap method that is a feature of python.

Web-refs:
https://docs.python.org/3/tutorial/modules.html#standard-modules
https://stackoverflow.com/questions/7643809/what-are-default-modules-in-python-which-are-imported-when-we-run-python-as-for

--
Regards =dn
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to