Track Python · Python Foundations · 13 min
Python in 2026. The language AI spoke first.
Why every Nobel-winning AI lab, every frontier model, every working agent, and every notebook in the field is written in the same 35-year-old programming language — and the four things that make it inevitable. Every code block in this article actually runs.
#The hook
In 2024, an AI program won the Nobel Prize in Chemistry. The language it was written in is the same one a 12-year-old uses for their first "guess the number" project on day one of an after-school class.
# Your first taste of Python — running in your browser, right now
name = "future AI engineer"
years = 2026
print(f"Hello, {name}!")
print(f"Welcome to the year {years}.")
print(f"You are about to learn the language that's eating the world.")#Why this matters in 2026 — the receipts
Numbers first. Python's grip on the AI/ML world is not a feeling — it's a measurable hegemony.
Python by the numbers
The most-used language in AI research
85%
ML papers using Python
arXiv 2025 survey
1M+
PyPI packages available
PyPI 2026
17M+
Active Python developers
JetBrains 2025
#3
Most-used language overall
TIOBE 2026
PyTorch is Python. TensorFlow is Python. JAX is Python. Hugging Face Transformers is Python. The Anthropic SDK and OpenAI SDK are Python. ChatGPT's RLHF training code is Python. Every fine-tuning notebook on the planet is Python. If you can read this, you have already met 60% of what you need to participate.
85%
of ML papers on arXiv use Python
The other 15% are split between R (statistics), Julia (HPC niche), and a long tail of domain languages. Python isn't just popular in AI — it's the de-facto standard. There's no realistic 2026 path to AI/ML mastery that bypasses it.
arXiv ML 2025 survey
“Python is the second-best language for everything. Which is exactly why it wins.”
#The 30-second answer — what makes Python special
Strip it down. Python does four things uniquely well, and stacking them is what makes it the AI/ML default. Every other language does one or two; Python does all four.
The four superpowers
Why Python won — in four moves
1. Reads like English
the design choiceif value > 0 and key in lookup is valid Python you can run, and grammatical English you can read aloud.
- No semicolons, no curly braces. Indentation IS the syntax.
- Researchers from biology, physics, finance can read each other's Python without translation.
- Lowers the on-ramp from 'months of syntax' to 'hours.'
2. Batteries included
the standard libraryRandom numbers, JSON, files, dates, regular expressions, networking — all in the language itself.
- import json, import datetime, import re — never npm install a basic primitive.
- Bundled tools push the boilerplate out of the picture so you focus on the actual problem.
- math, statistics, collections, itertools — primitives a data scientist uses daily.
3. Glue language
the killer featurePython is the friendly UI that drives the heavy machinery written in C, C++, Rust, and CUDA.
- NumPy is Python on the surface, decades-tuned C/Fortran underneath.
- PyTorch tensors look pure-Python — they're CUDA kernels in a fresh trench coat.
- Lets you write expressive code that runs at compiled-language speed.
4. Network effects
the ecosystem1M+ packages on PyPI. Every researcher publishes in Python. Every textbook teaches Python.
- Hugging Face hosts 1M+ models — every download example is in Python.
- Kaggle, Google Colab, Jupyter — the entire daily-driver toolchain assumes Python.
- Two decades of compounding investment — the ecosystem is now too far ahead to displace.
#How it actually feels — the tour
#1. Variables and types — no ceremony
# Python figures out the type from the value. No type declaration needed.
name = "Ada" # a string
age = 31 # an integer
height = 5.6 # a float
is_pioneer = True # a boolean
favourite_numbers = [42, 137, 1729] # a list
print(f"{name} is {age} years old, {height}ft tall, pioneer = {is_pioneer}.")
print(f"Lucky numbers: {favourite_numbers}, biggest = {max(favourite_numbers)}.")#2. Loops and conditions — readable as prose
# Filter a list of grades, label each one. Reads top to bottom in English.
grades = [88, 42, 91, 67, 73, 55, 95]
for g in grades:
if g >= 90:
label = "A"
elif g >= 75:
label = "B"
elif g >= 60:
label = "C"
else:
label = "needs work"
print(f" {g} -> {label}")for g in grades is the entire loop. No counter variable, no i++, no array length lookup. Python collections know how to iterate themselves.#3. Functions — small, named, reusable
# A function is a named block of code you can call by its name.
def is_prime(n):
"""Return True if n is a prime number."""
if n < 2:
return False
for divisor in range(2, int(n ** 0.5) + 1):
if n % divisor == 0:
return False
return True
# Try it
for x in range(2, 20):
if is_prime(x):
print(f"{x} is prime")range(2, 20) to range(2, 100). Watch the output expand. Programming is just deciding what changes and what stays.#4. List comprehensions — the Python superpower
# Build a list inline. Reads like a math expression.
squares = [n ** 2 for n in range(1, 11)]
evens = [n for n in range(20) if n % 2 == 0]
uppercased = [w.upper() for w in ["hello", "world", "python"]]
print("Squares: ", squares)
print("Evens: ", evens)
print("Uppercased: ", uppercased)A list comprehension does in one line what most languages need a for-loop, an if-block, and an .append() to do. This pattern shows up everywhere in numerical Python.
#5. The 5-line program that calls a real ML model
This is where Python earns its place in AI. Here's a real machine-learning model — a random forest — trained on real data, predicting a real flower species, in 6 lines:
from sklearn.datasets import load_iris
from sklearn.ensemble import RandomForestClassifier
X, y = load_iris(return_X_y=True)
model = RandomForestClassifier(n_estimators=100, random_state=42).fit(X, y)
species = ["setosa", "versicolor", "virginica"]
new_flower = [[5.1, 3.5, 1.4, 0.2]]
prediction = model.predict(new_flower)[0]
print(f"Predicted species: {species[prediction]}")
print(f"Confidence: {model.predict_proba(new_flower)[0][prediction]:.0%}")new_flower — the four measurements (sepal length, sepal width, petal length, petal width) — and watch the prediction shift.This is what people mean when they say Python is "the language AI spoke first." That same six-line pattern, scaled up to billions of parameters and trained on the internet, is GPT-4.
The vocabulary
Six Python concepts you'll meet daily
Concept
List comprehension
Build a list inline with a math-like expression.
Like: Set-builder notation from school math.
e.g. [n*n for n in range(10) if n%2==0]
Concept
Decorator
A function that wraps another function to add behavior.
Like: A coat over a shirt — same person, more capability.
e.g. @app.route('/api/predict')
Concept
f-string
Inline string interpolation. {expr} inside f"...".
Like: Mail merge for strings.
e.g. f"score: {accuracy:.2%}"
Concept
Generator
Lazy iteration. Yields values one at a time.
Like: Streaming a movie vs. downloading it all.
e.g. yield in a function body
Concept
Type hint
Optional annotations that document expected types.
Like: Comments the IDE actually reads.
e.g. def predict(x: np.ndarray) -> int:
Concept
Context manager
Setup and cleanup wrapped in a with-block.
Like: Hotel checkout — automatic when you leave.
e.g. with open('f.txt') as f: ...
#The 2026 frontier — Python is finally fast
- PEP 703 — Free-threading (3.13 experimental, 3.14 stable in 2026): the GIL is now optional. Multi-core Python without
multiprocessingworkarounds. - PEP 744 — JIT compiler (3.13+): a copy-and-patch JIT layer that makes hot loops 10–60% faster with no code changes.
- uv (the new pip + venv replacement, written in Rust): 10–100× faster package installs. The Python ecosystem is finally getting the tooling it deserved a decade ago.
Combined: a 2026 Python program can saturate 32 cores, JIT-compile its hot paths, and install its dependencies in 4 seconds instead of 4 minutes. The "Python is slow" critique is rapidly dating itself.
#What's been built with Python
Six systems you've used today, and the Python that runs them:
Real-world Python
What this language has actually shipped
Social network
2B+
Monthly active users
Backend is Django (Python). Most-used Django site in the world. Python serves the photo feed for 2B people.
Glue + scale
Deep learning
PyTorch
80%
AI papers using PyTorch
The framework Meta open-sourced. Now powers ~80% of new ML research. Pure-Python API over CUDA kernels.
Glue language
Model hub
Hugging Face
1M+
Models hosted
The GitHub of AI models. Every download example is Python. transformers library is the de-facto LLM toolkit.
Network effects
Space
NASA / JPL
30+
Years of mission Python
Mars rovers, telescope pipelines, mission control dashboards. Python wherever Fortran and C++ pause for breath.
Reads like English
Internal tooling
#1
Most-used by Googlers
Internal dashboards, build systems, scientific computing. Python is one of Google's three official languages.
Batteries included
Music platform
Spotify
100+
Backend services in Python
Recommendation systems, data pipelines, playlist generation — all Python with a healthy Scala/Java mix.
Glue + AI
#Run a real ML benchmark — interactive
To make Python's "glue language" superpower concrete: the cell below benchmarks a real numerical operation (a 1000×1000 matrix multiply) — first in pure Python, then via NumPy, which calls into 30-year-old optimized BLAS Fortran. Watch the speedup.
import time
import numpy as np
# Build two 200x200 random matrices (kept small so pure-Python finishes fast)
n = 200
A = [[(i * j) % 7 for j in range(n)] for i in range(n)]
B = [[(i + j) % 5 for j in range(n)] for i in range(n)]
# Pure-Python matrix multiply — three nested loops
start = time.time()
C = [[0] * n for _ in range(n)]
for i in range(n):
for j in range(n):
for k in range(n):
C[i][j] += A[i][k] * B[k][j]
pure_time = time.time() - start
print(f"Pure Python: {pure_time*1000:7.1f} ms")
# Same operation via NumPy — single line, calls into BLAS under the hood
A_np, B_np = np.array(A), np.array(B)
start = time.time()
C_np = A_np @ B_np
numpy_time = time.time() - start
print(f"NumPy: {numpy_time*1000:7.1f} ms")
print(f"Speedup: {pure_time / numpy_time:.0f}x faster")#Where to go next
If this clicked, here's the path through the curriculum that takes you from "I just ran my first Python" to "I'm building real AI tools":
- Python Foundations track — 39 lessons, beginner to fluent. Variables → loops → functions → OOP → file I/O → APIs → async. Every code block runs in your browser.
- Math Foundations — 17 lessons covering vectors, calculus, probability — the math you actually need for ML. Read the Math Foundations blog (coming next) for the high-level overview first.
- Data Foundations — 15 lessons on real-world data pipelines: cleaning, feature engineering, train/test split, drift detection. The 80% of ML work that decides whether your model succeeds.
- Classical ML — your first real models. Linear regression to XGBoost. The 80% of "AI" that isn't an LLM.
By the end of those four tracks, you'll have written hundreds of lines of working Python and trained a dozen models — without ever installing anything locally.
#Key takeaways
Key Takeaways
- Python is the lingua franca of AI/ML — every major framework, paper, and notebook is in Python.
- Four superpowers stack: reads like English, batteries included, glue language for C/CUDA, two-decade ecosystem network effects.
- The 'Python is slow' critique is dating fast — free-threading (PEP 703), JIT (PEP 744), and uv tooling close most performance gaps in 2026.
- You can't avoid Python if you want to ship AI. Even Java/Go/.NET stacks touch Python the moment they touch a model.
- Same syntax, same idioms — Python serves first-day learners and Nobel-winning labs equally well.
- Don't install anything to start. The lessons (and this blog) run Python in your browser via Pyodide WebAssembly.
#References & further reading
- The Python Tutorial (docs.python.org/3/tutorial/) — the official walkthrough. Better than 90% of paid courses.
- Mark Lutz — Learning Python (5th ed). The definitive doorstop. Skip the first 100 pages if you're impatient.
- Luciano Ramalho — Fluent Python (2nd ed, 2022). What you read once you're past beginner.
- Python for Data Analysis by Wes McKinney (the creator of Pandas). 3rd edition, 2022.
- Sebastian Raschka — Machine Learning with PyTorch and Scikit-Learn (2022). Best on-ramp from Python to ML.
- Jeremy Howard — fast.ai courses. Python + PyTorch from the top down. Free.
- PEP 703 — Making the GIL Optional in CPython. (peps.python.org/pep-0703)
- PEP 744 — JIT Compilation. The copy-and-patch JIT shipping in 3.13+.
- Astral.sh / uv — the Rust-written package installer that's 10–100× faster than pip. The new default for serious work.