I am using anaconda in Windows os, I am trying to realize the structure of the whole python environment.
For example, I want to check the implementation file of the module itertools
. However, when I take a look into the folder which path is anaconda3/envs/my_envs/Lib
there's no any python file named itertools.py
.
How can I find the exactly file that contained all these implementations code from docs.python.org
CodePudding user response:
You can refer the Cpython source code which is the “official,” or reference implementation of Python. Some of the standard library modules are implemented in C
(For the purpose of speed/system calls/library bindings) and itertools
is one among them. You can find the itertools.permutations
implementation here.
If you want to understand how the source code is structured you can refer Your Guide to the CPython Source Code. To understand C
extension structure and how to create your own refer Extending Python with C or C
CodePudding user response:
you can use help function or inspect function. please refer below answer Finding the source code for built-in Python functions?