In Python 3.x, why is there not an itertools shared-object on disk?

前端 未结 2 1998
刺人心
刺人心 2021-01-19 18:34

Is the itertools C module included somehow in the main Python binary in 3.x?

Assuming that the C module is built and included, which it appears to be:



        
2条回答
  •  庸人自扰
    2021-01-19 18:47

    In Python 3, the itertools extension is compiled into the main Python binary:

    >>> import sys
    >>> 'itertools' in sys.builtin_module_names
    True
    

    See the sys.builtin_module_names documentation:

    A tuple of strings giving the names of all modules that are compiled into this Python interpreter.

    The module was added to the Python binary because it is used very widely in the Python standard library.

    The list of modules to include is taken from the Modules/Setup.dist file in the Python distribution; itertools was added together with _collections, as it is a transient dependency of that module. See issue #9545.

提交回复
热议问题