Blog

What Is Python, Really?

Understand the difference between Python the language, CPython the implementation, and the runtime and standard library that execute Python programs.

What Is Python, Really?

I'm starting a series about common interview questions for software engineers. After more than ten years of interviewing candidates, I have learned that simple questions often reveal the deepest gaps in our mental models.

This series was inspired by Python Interview Questions. Part I. Junior. I want to answer its early-career questions for developers who already use a language—or are preparing to—but want to understand what is happening below the syntax.

Why start with Python instead of Ruby? Ruby remains my primary backend language, but Python is widely used in education, automation, data science, web development, and embedded systems. It is a natural place to begin.

The first question is deceptively short: What is Python?

The interview answer is usually something like this:

Python is a high-level, general-purpose programming language with dynamic typing and automatic memory management.

That is correct, but incomplete. In everyday conversation, Python can refer to at least three related things:

  1. the Python programming language;
  2. a Python implementation, usually CPython;
  3. the runtime environment and standard library delivered with that implementation.

Understanding those layers gives us a much better answer.

A language is a set of rules

A programming language defines how programs are written and what they mean. It includes:

  • syntax—which sequences of characters form valid programs;
  • semantics—what valid programs are supposed to do;
  • data and object models—how values, objects, types, and operations behave;
  • control flow—how functions, conditions, loops, and exceptions work;
  • module and execution rules—how names are resolved and code is organized.

The Python Language Reference documents these rules. Consider a small program:

def greet(name):
    return f"Hello, {name}!"
 
print(greet("Ada"))

The language tells us how to define and call greet, how an f-string is evaluated, and how name lookup works. Those rules do not execute themselves, however. A concrete program must implement them.

An implementation makes the language run

A language implementation is software that accepts programs written in a language and gives those programs their specified behavior. It may contain a parser, compiler, interpreter, virtual machine, runtime services, garbage collector, and standard library.

These terms describe jobs, not mutually exclusive categories:

  • A compiler translates code from one representation to another. Its output might be native machine code, bytecode, or another intermediate representation.
  • An interpreter executes a program or intermediate representation.
  • A virtual machine is an abstract computer with its own instruction set. Its implementation may interpret those instructions, compile them just in time, or combine both approaches.
  • A runtime supplies the machinery a running program needs: objects, memory management, function calls, exceptions, imports, and interaction with the operating system.

This is why classifying every language as either "compiled" or "interpreted" is misleading. A language does not require one execution strategy, and one implementation can use several.

flowchart LR
    A["Source code"] --> B["Parser and compiler"]
    B --> C{"Generated representation"}
    C --> D["Native machine code"]
    C --> E["Bytecode or intermediate representation"]
    E --> F["Interpreter or virtual machine"]
    E --> G["Just-in-time compiler"]
    D --> H["Operating system and CPU"]
    F --> H
    G --> H

Different implementations of the same language can choose different paths through this diagram.

CPython is the Python most people mean

CPython is the original, most widely used implementation of Python. It is written primarily in C, which explains the name.

When you download Python from python.org and run python or python3, you are normally running CPython. That convention is so common that people use Python for both the language and its default implementation.

CPython does not simply read a source file one line at a time. In simplified form, it parses and compiles Python source into CPython bytecode, then its virtual machine executes that bytecode. The Python glossary explicitly describes bytecode as CPython's internal representation and warns that it is neither a cross-implementation format nor stable between Python releases.

flowchart LR
    A["Python source (.py)"] --> B["CPython parser and compiler"]
    B --> C["CPython bytecode"]
    C --> D["CPython evaluation loop and runtime"]
    D --> E["Operating system and CPU"]

The CPython package also provides the object model, memory management, import system, built-in functions, C extension API, and the Python standard library. Some of these are language guarantees; others are CPython implementation details. Confusing the two can make code depend accidentally on CPython-specific behavior.

You can ask a running implementation to identify itself:

import sys
 
print(sys.implementation.name)

On CPython, this prints cpython. The important point is that python is not the only possible answer.

Python has other implementations

The language and implementation are separate enough that several runtimes can execute Python programs. The Python documentation and Python.org's alternatives page list implementations designed for different environments:

ImplementationEnvironment or goal
CPythonThe original and most widely used implementation, written primarily in C
PyPyA Python implementation with a tracing just-in-time compiler
JythonPython on the Java Virtual Machine, with access to Java libraries
IronPythonPython on .NET, with access to the .NET ecosystem
MicroPythonA compact implementation optimized for microcontrollers and constrained environments
GraalPyAn embeddable Python runtime for GraalVM and Java applications

These implementations are not interchangeable in every detail. They may support different Python versions, expose different runtime behavior, or have different compatibility with native extensions. A package built against CPython's C API, for example, does not automatically work on every other implementation.

Still, they all demonstrate the central distinction: Python the language is not identical to CPython the implementation.

Java makes the layers easier to see

The word Java has the same ambiguity. Depending on context, it can mean:

  • the Java programming language;
  • the javac compiler;
  • the Java Virtual Machine (JVM);
  • the Java standard APIs and wider Java platform;
  • the JDK, which packages development and runtime tools.

Java source is commonly compiled by javac into .class files containing JVM bytecode. A JVM implementation then loads and executes that bytecode, often using both interpretation and just-in-time compilation.

Most importantly, the JVM is not the Java language. The Java Virtual Machine Specification says that the JVM knows the class file format rather than the Java language. Any language implementation capable of producing or using valid JVM classes can run on that platform.

That is why Kotlin, Scala, JRuby, and Jython can share the JVM and Java libraries without becoming the Java language.

flowchart TD
    A["Java"] --> AC["Java compiler"]
    B["Kotlin"] --> BC["Kotlin compiler"]
    C["Scala"] --> CC["Scala compiler"]
    D["Ruby"] --> DC["JRuby implementation"]
    E["Python"] --> EC["Jython implementation"]
    AC --> VM["JVM and Java platform libraries"]
    BC --> VM
    CC --> VM
    DC --> VM
    EC --> VM
    VM --> OS["Operating system and hardware"]

This also corrects another common misconception: a software platform does not have to belong to exactly one source language.

Ruby follows the same pattern

Ruby is a programming language. The implementation most people install is CRuby, historically called MRI (Matz's Ruby Interpreter). CRuby is written primarily in C and includes a compiler, the YARV virtual machine, garbage collection, runtime services, and the standard library.

Like CPython, modern CRuby compiles source into virtual-machine instructions before executing them. Calling it an interpreter is useful at a high level, but it does not mean that compilation is absent.

Ruby also has alternative implementations:

  • JRuby runs Ruby on the JVM;
  • TruffleRuby runs Ruby on GraalVM and focuses on performance;
  • mruby is a lightweight implementation designed to be embedded in applications and constrained environments;
  • IronRuby brought Ruby to .NET, although it is now a historical rather than mainstream implementation.

The parallel is useful:

GoalPythonRuby
Default, C-based implementationCPythonCRuby
JVM integrationJythonJRuby
.NET integrationIronPythonIronRuby (historical)
Small or embedded systemsMicroPythonmruby
Alternative high-performance runtimePyPyTruffleRuby

MicroPython and mruby are especially good reminders that a language can be reimplemented for a very different environment without becoming a new language. They aim to preserve the essential language while making deliberate trade-offs for memory, compatibility, and platform integration.

So, is Python a platform?

In the strictest sense, Python is a programming language. CPython is an implementation of that language. A typical CPython installation, together with its runtime and standard library, provides a practical software platform on which Python applications run.

The boundary is conversational rather than absolute. When somebody says, "Python has reference counting," they usually mean CPython. When they say, "Python uses indentation to define blocks," they mean the language. When they say, "Install Python on the server," they probably mean a Python distribution containing an implementation and its runtime environment.

The word is the same; the layer changes with context.

A better interview answer

If an interviewer asks, "What is Python?", a concise but precise answer is:

Python is a high-level, general-purpose programming language. To run Python code, we need an implementation. The most common implementation is CPython, which compiles source code to its own bytecode and executes it in the CPython runtime. Other implementations include PyPy, Jython, IronPython, and MicroPython, so Python the language should not be confused with CPython the implementation.

That answer shows more than memorized features. It shows that you understand the full path from language rules to a running program—and that names such as Python, Ruby, and Java often describe several connected layers at once.