Skip to content Skip to sidebar Skip to footer

In Python 3.x, Why Is There Not An Itertools Shared-object On Disk?

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: >>> import inspect

Solution 1:

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.

Post a Comment for "In Python 3.x, Why Is There Not An Itertools Shared-object On Disk?"