Lesson 1 of 52First steps
The Story of Python
Where Python came from, who decides how it changes, what really happens when you run a .py file, and where the GIL stands in 2026.
Python runs Instagram's backend, most of the world's machine learning, and countless little scripts that save people hours every week. Knowing where it came from explains why it looks the way it does, and interviewers love two questions from this lesson: "Is Python compiled or interpreted?" and "What is the GIL?"
A holiday project that took over
In December 1989, a Dutch programmer named Guido van Rossum was working at CWI, a research institute in Amsterdam. The office was closed for Christmas, so he started a hobby project: a scripting language that was easier to write than C and more powerful than shell scripts.
1989
A Christmas project
Guido van Rossum starts writing an interpreter at CWI in Amsterdam, borrowing ideas from a teaching language called ABC.
1991
Version 0.9.0
Posted publicly on Usenet. It already has functions, exceptions, classes, and the core types `list`, `dict` and `str`.
1994
Python 1.0
Adds `lambda`, `map`, `filter` and `reduce`. A community starts to form.
2000
Python 2.0
List comprehensions, Unicode strings, and a garbage collector that can clean up reference cycles.
2008
Python 3.0
A deliberate break with the past to fix old design mistakes. Python 2 code does not run unchanged.
2018
Guido steps down
After a bruising debate over the walrus operator (`:=`), Guido resigns as 'Benevolent Dictator For Life'. An elected five-person Steering Council has run the language since 2019.
2020
Python 2 is retired
Official support ends on 1 January 2020. The very last release, 2.7.18, ships that April.
2022
Python 3.11 gets fast
The Faster CPython project makes typical code about 25% faster with no changes needed.
2024–25
3.13 and 3.14
An optional build without the GIL arrives in 3.13 as an experiment and becomes officially supported, but still optional, in 3.14. A new release now ships every October.
2026
Python 3.15
Released 9 October: explicit lazy imports, UTF-8 by default everywhere, a built-in `frozendict`, and a sampling profiler called Tachyon. Python 3.10 reached end of life on 1 October.
The name has nothing to do with snakes. Guido was reading scripts from the BBC comedy show Monty Python's Flying Circus and wanted a name that was short, unique and slightly mysterious. You will still see the jokes in official docs, where example variables are often called spam and eggs.
Why Python reads the way it does
Python borrowed heavily from ABC, a language Guido had helped build at CWI. ABC was designed for teaching, and it had two ideas Python kept:
- Indentation is syntax. Blocks are marked by indenting, not by curly braces. Code that looks nested is nested.
- Readability beats cleverness. A few powerful built-in types (lists, dicts, strings) instead of many specialised ones.
ABC failed because it was closed off: hard to extend and hard to connect to the operating system. Python fixed that by making it easy to call C code and talk to files, networks and processes. That mix (pleasant to read, but able to do real work) is why it spread.
The design values were later written down as a short poem called the Zen of Python (PEP 20). A PEP is a Python Enhancement Proposal: the public document every big change goes through. The Zen is hidden inside Python itself. Run this:
Press Run (⌘ Enter) to see what happens.A few lines worth remembering: "Readability counts." "There should be one, and preferably only one, obvious way to do it." "Errors should never pass silently." You will see each of these show up in later lessons.
if block?Python 2 to Python 3: the long migration
By the mid-2000s, Python had some mistakes baked in. Text and raw bytes were muddled together, print was a special statement instead of a function, and 7 / 2 gave 3 because dividing two integers threw away the remainder.
Python 3.0 (December 2008) fixed these, knowing it would break old code. The migration took more than a decade: big libraries had to support both versions, and companies had millions of lines to port. Python 2 was finally retired on 1 January 2020. Today, "Python" means Python 3, and any tutorial that writes print "hello" without parentheses is from the old world.
What does this print?
print(7 / 2) print(7 // 2)
Match each Python 2 habit with how Python 3 does it.
Who decides how Python changes
The Python 2 to 3 saga left the community allergic to big breaking changes, and it shaped how Python is run today. Three things are worth knowing, because they explain what you see in release notes and why upgrades look the way they do.
PEPs are where decisions happen. Any significant change, from new syntax to a new standard library module, starts as a PEP that is argued over in public on discuss.python.org. That is why you will see features referred to by number: PEP 8 for style, PEP 484 for type hints, PEP 703 for removing the GIL. Reading the "Motivation" and "Rejected ideas" sections of a PEP is the fastest way to understand why a feature works the way it does, and seniors quote them in design reviews.
A council, not a dictator. For almost thirty years Guido had the final say, with the jokey title Benevolent Dictator For Life. In 2018, after a heated fight over PEP 572 (the walrus operator, :=), he stepped down. The core developers chose a new model (PEP 13): a Steering Council of five, elected after each release, that accepts or rejects PEPs. Guido is still a core developer, just not the decider.
One release every October. Since Python 3.9, a new feature release ships every year (PEP 602). Each one gets about two years of bugfix releases (3.14.1, 3.14.2 and so on), then security-only fixes until five years after launch, then end of life: no fixes at all, even for serious vulnerabilities. Deprecated features usually get at least two releases of warnings before they are removed, so code that runs cleanly with warnings turned on rarely breaks on the next upgrade.
Here is where things stand in late October 2026:
| Version | Status |
|---|---|
| 3.10 and older | End of life (3.10 on 1 October 2026). Upgrade anything still running on it. |
| 3.11, 3.12, 3.13 | Security fixes only |
| 3.14 | Bugfix. The sensible default for production today. |
| 3.15 | Bugfix, newest (9 October 2026). Move production once your key libraries ship wheels for it. |
| 3.16 | In development, planned for October 2027 |
What Changed in Python 3.11 to 3.15 walks through each release feature by feature. At work, the practical rule is: know which version your services run on, and upgrade one release at a time, every year or two, instead of four at once.
Put the stages of a Python release's life in order.
- Tap the steps below in the right order.
Where Python is used today
| Area | What Python does there | Tools you will hear about |
|---|---|---|
| Web backends | APIs and websites | FastAPI, Django, Flask |
| Data | Cleaning, analysing and charting data | pandas, Polars, Jupyter |
| AI and machine learning | Training and serving models | PyTorch, scikit-learn, Hugging Face |
| Scripting and automation | Renaming files, calling APIs, glue code | the standard library, requests |
| DevOps and infrastructure | Build scripts, cloud automation | Ansible, the AWS SDK boto3 |
A pattern worth noticing: in data and AI, Python is usually the friendly front for code written in C, C++ or CUDA. When PyTorch multiplies two huge matrices, Python makes one call and fast native code does the heavy lifting. You get readable code and fast execution.
What happens when you press run
"Python" is a language, a set of rules. The program that actually runs your code is an implementation. The standard one, which you download from python.org, is CPython, written in C. It is the reference implementation: when people say "Python does X", they mean CPython does X. (Others exist: PyPy has a JIT compiler, and this site runs Python in your browser with Pyodide, which is CPython compiled to WebAssembly.)
CPython runs your file in two stages. (How Code Runs in Start Here explained compilers, bytecode and JIT in general; this is the Python version.)
You write hello.py. To your computer it is just text.
You can see the bytecode yourself with the dis (disassemble) module. The exact instructions change between versions, so do not memorise them.
Press Run (⌘ Enter) to see what happens.Put the steps CPython takes to run a file in order.
- Tap the steps below in the right order.
Where the speed came from
For most of its life, CPython's virtual machine was simple on purpose: easy to read and maintain, but slow. Since 3.11, the Faster CPython effort has changed that without asking you to change any code. Knowing the outline helps you answer "is Python slow?" with something better than a shrug.
- A specialising interpreter (3.11, PEP 659). CPython watches each instruction as it runs. If
t + pkeeps adding two ints, the generic add instruction is swapped for one that only handles ints and skips the type checks. If a float turns up later, it falls back. This is called quickening, and it is most of the 3.11 speed-up. - Cheaper calls and exceptions. Function frames became lighter, so Python-to-Python calls got faster, and a
tryblock now costs essentially nothing until an exception is actually raised. - An experimental JIT (3.13 onward, PEP 744). A "copy-and-patch" JIT that stitches together pre-compiled machine code templates. It is still experimental and off by default in 3.15, and its speed-ups so far are modest. Do not plan around it.
You can watch the specialising interpreter work. Run a function enough times, then ask dis for the adaptive bytecode:
Press Run (⌘ Enter) to see what happens.Look for instructions like BINARY_OP_ADD_INT and FOR_ITER_LIST: the generic BINARY_OP and FOR_ITER have been specialised for the types they actually saw. The exact names change between versions.
Even with all this, a tight loop of pure Python is still many times slower than the same loop in C. That is why the pattern from the "Where Python is used today" section matters: the fast path in real systems is Python calling native code (NumPy, Polars, PyTorch, database drivers), with Python as the glue. Profiling Python covers how to find where your own time goes.
The GIL, in one paragraph
CPython has a Global Interpreter Lock (GIL): a lock that lets only one thread run Python bytecode at a time, even on a 16-core machine. It made CPython's memory management simple and single-threaded code fast. The cost is that threads cannot speed up CPU-heavy Python code; they still help with waiting (network calls, files), because the GIL is released while a thread waits. Python 3.13 added an optional free-threaded build (installed as python3.13t) with no GIL, as an experiment. In 3.14 it became officially supported (PEP 779), but it is still a separate, optional build (python3.14t). Python 3.15 keeps it optional: it adds a stable ABI for free-threaded builds (abi3t, PEP 803) so extension authors can ship one wheel for several versions, and the macOS installer now installs the free-threaded interpreter alongside the normal one. The plain python3 you install still has a GIL. It is not the default yet because some C extensions still need updating and single-threaded code runs somewhat slower and uses more memory on it. So "Python has removed the GIL" is wrong; "CPython offers an optional build without it" is right.
You can check which kind of interpreter you are on:
Press Run (⌘ Enter) to see what happens.The two lines answer different questions. Py_GIL_DISABLED says whether this interpreter was built without the GIL. sys._is_gil_enabled() (3.13+) says whether the GIL is on right now, because a free-threaded build turns the GIL back on if you import a C extension that has not declared it is safe without it (you can override that with PYTHON_GIL=0, at your own risk).
Why removing the GIL took thirty years
The GIL protects CPython's reference counts. Every object carries a count of how many references point at it, and it is freed when the count hits zero. With two threads updating the same count at once, without a lock, counts go wrong and objects get freed while still in use. Earlier attempts (as far back as 1999) replaced the GIL with fine-grained locks and made single-threaded Python much slower, which was never acceptable.
PEP 703 (Sam Gross) found a combination that works: biased reference counting (the thread that owns an object updates its count cheaply, other threads use slower atomic operations), immortal objects (None, small ints and the like never get counted at all, PEP 683), deferred reference counting for objects like functions and modules that many threads touch, a thread-safe memory allocator (mimalloc), and per-object locks inside list, dict and friends so a single operation cannot corrupt them.
The hard part now is the ecosystem. Every C extension has to be checked and marked as safe to run without the GIL, which is why the build stays optional while libraries catch up. Your own code is a separate question: the GIL never made multi-step operations like count += 1 safe, and free-threading does not either. Threads and the GIL covers locks and queues; Processes, Subinterpreters and Free-Threaded Python covers when the free-threaded build is worth trying.
Interpreted or compiled? Dynamic and strong
Interpreted vs compiled is less of a yes/no than it sounds. A language like C is compiled ahead of time straight to machine code. Python is compiled to bytecode, and that bytecode is interpreted by the virtual machine. So the honest answer is "compiled to bytecode, then interpreted", and people shorten that to "interpreted".
Python is also dynamically typed: a variable has no fixed type, and types are checked while the program runs, not before. And it is strongly typed: Python refuses to silently convert between unrelated types. JavaScript will happily turn "3" + 4 into "34". Python stops you:
Press Run (⌘ Enter) to see what happens.How this course is laid out
The Python course has ten units, and each one leans on the last:
- First steps and Collections: values, conditions, loops, and the lists, dicts and sets you will use in every program.
- Functions and Objects: breaking code into reusable pieces, then building your own types with classes and dataclasses.
- Pythonic Python and Types in depth: exceptions, decorators, generators, context managers, async and type hints, the tools that make code read like Python.
- Python power tools: files, JSON, regex, dates, logging, command-line scripts and a tour of the standard library.
- Concurrency and performance and Python under the hood: threads, processes, profiling, and how attributes and classes really work.
- Real projects: packages, environments, project layout, packaging, upgrades, testing and security, so your code holds up at work.
By the end you can read most production Python and build, test and ship a small project of your own. The course closes with a wrap-up that walks through one job using all of it.
- CPython
- The standard Python implementation, written in C. It compiles source to bytecode and runs it on a virtual machine.
- bytecode
- Simple instructions CPython compiles your code into. Cached as
.pycfiles in__pycache__/. - GIL
- Global Interpreter Lock: lets only one thread run Python bytecode at a time in CPython. Optional free-threaded builds remove it (3.13+); the default build still has it.
- free-threaded build
- A separate CPython build without the GIL, such as
python3.14t. Experimental in 3.13, supported but optional from 3.14. - Steering Council
- The five elected core developers who accept or reject PEPs, in place of a single leader since 2019.
- end of life
- The point, about five years after release, when a Python version gets no more fixes. 3.10 reached it on 1 October 2026.
- specialising interpreter
- CPython 3.11+ rewrites hot bytecode into type-specific instructions, like
BINARY_OP_ADD_INT, as it runs. - PEP
- Python Enhancement Proposal: the public design document for a change to Python. PEP 8 is the style guide, PEP 20 is the Zen.
- dynamic typing
- Types belong to values, not names, and are checked while the program runs.
- strong typing
- The language refuses to silently convert between unrelated types, so
"3" + 4is an error.