CPython

CPython is the reference and official implementation of the Python programming language. Written in C, it is the most widely used version of Python and serves as the standard upon which other implementations are based.

When you download Python from the official website, python.org, you’re getting CPython. This implementation is known for its performance and compatibility with various C libraries, making it a popular choice for many Python developers.

Example

Once you install Python from the python.org website, you can run the python command on a terminal window. Then, you’ll get something like the following on your screen:

Python
Python 3.12.2 (main, Mar 10 2024, 19:25:46)...
Type "help", "copyright", "credits" or "license" for more information.
>>> 

This is a Python REPL (Read-Eval-Print Loop) session where you can run Python code interactively. You can check the Python implementation you’re using by running the following code:

Python
>>> import platform
>>> platform.python_implementation()
'CPython'

In this code, you call the python_implementation() function from the platform module to check the Python implementation in use.

Tutorial

Your Guide to the CPython Source Code

In this detailed Python tutorial, you'll explore the CPython source code. By following this step-by-step walkthrough, you'll take a deep dive into how the CPython compiler works and how your Python code gets executed.

advanced python

For additional information on related topics, take a look at the following resources:


By Leodanis Pozo Ramos • Updated Dec. 19, 2024 • Reviewed by Dan Bader