Where do I find the python standard library code?

The canonical repository for CPython is this Mercurial repository. There is also a git mirror on GitHub.


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.

Tags:

Python