[Python-Dev] Re: New sys.module_names attribute in Python 3.10: list of all stdlib modules

2021年1月25日 07:35:46 -0800

On Mon, Jan 25, 2021 at 4:18 PM Antoine Pitrou <[email protected]> wrote:
>
> On 2021年1月25日 14:03:22 +0100
> Victor Stinner <[email protected]> wrote:
> >
> > The list is opinionated and defined by its documentation:
>
> So "the list is opinionated" means there can be false negatives, i.e.
> some stdlib modules which are not present in this list?
Test modules of the stdlib are excluded. Example:
>>> import sys
>>> '_testcapi' in sys.module_names # _testcapi extension
False
>>> 'test' in sys.module_names # Lib/test/ package
False
>>> import _testcapi
>>> _testcapi
<module '_testcapi' from
'/home/vstinner/python/master/build/lib.linux-x86_64-3.10-pydebug/_testcapi.cpython-310d-x86_64-linux-gnu.so'>
>>> import test
>>> test
<module 'test' from '/home/vstinner/python/master/Lib/test/__init__.py'>
It can be changed if it's an issue. That's also why I sent an email to
python-dev, to see if there is something wrong with sys.module_names
definition.
Victor
-- 
Night gathers, and now my watch begins. It shall not end until my death.
_______________________________________________
Python-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/VVTGOIJYIS66A4C6JZDQQTIFXGNKKJEL/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to