Where do I find the python standard library code?

In cpython, many modules are implemented in C, and not in Python. You can find those in Modules/, whereas the pure Python ones reside in Lib/.

In some cases (for example the json module), the Python source code provides the module on its own and only uses the C module if it’s available (to improve performance). For the remaining modules, you can have a look at PyPy’s implementations.

Leave a Comment