Python:batteries included
A side project Guido van Rossum started during the 1989 Christmas holidays "to keep me occupied." Thirty-five years later, it powers half of the world's AI research, data analysis, and CS education — from your shell scripts to the PyTorch code that trained ChatGPT, to the Python modules onboard NASA spacecraft.
Linux Foundation 2024
Stack Overflow Survey
TS overtook by +42k · Octoverse 2025
3.13t · Oct 2024
What is Python
Python is a dynamically typed, interpreted, indentation-structured general-purpose language. It was not built for any single domain, yet over three decades it has captured scripting, web back-ends, automation, scientific computing, deep learning, and the LLM era — without ever truly retreating from any of them.
"If it walks like a duck and quacks like a duck, it's a duck." Variables don't carry types — only the runtime behavior matters. The cost is errors deferred to runtime; the gain is speed of expression.
No braces, no begin/end. Code blocks are expressed by 4-space indentation. Every Python file ends up looking similar — style debates die at the source.
Run python foo.py directly. CPython compiles source to bytecode (.pyc) and runs it on a VM — slower, but instant edit-and-go.
The standard library covers files, networking, JSON, crypto, subprocess, testing, GUI — usable out of the box. A philosophy Guido fixed in the 1990s and 30 years haven't changed.
// C: 120 lines + malloc / free / hashtable
// Watch out for segfaults
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// ... roll your own hashtable ...
// ... fopen / fgets / tokenize ...
// ... sort and print ...
// ... don't forget to free() ...
// gcc -O2 word_count.c
// 100MB text ≈ 0.8sfrom collections import Counter
words = open("book.txt").read().split()
for w, n in Counter(words).most_common(10):
print(w, n)
# 4 lines · runs as-is · 100MB ≈ 5s
# 6× slower, 30× shorter
# For 99% of scripts, Python winsHistory : Timeline
From a Dutchman's Christmas hobby to the universal teaching language and the AI era's headline tongue — what happened in 35 years.
- 1989·12
The Christmas hobby project
Guido van Rossum, at the CWI research institute in the Netherlands, wanted "a project to keep me occupied during the week around Christmas" while the office was closed. Inspired by the teaching language ABC, he started a readability-first, dynamically typed language with niceties like
__init__. The name comes from the BBC sketch show Monty Python's Flying Circus — nothing to do with the snake. - 1991·02
0.9.0 ships on alt.sources
February 20. Guido posts the first public release to the Usenet newsgroup
alt.sources. It already has classes, exceptions, functions, modules, dictionaries, lists — modern Python, minus a few syntax sugars. - 2000·10
2.0 — list comprehensions + GC
October 16, Python 2.0. Introduces list comprehensions (syntax borrowed from Haskell), a cycle-detecting garbage collector, and Unicode support. Development moves to a fully community-backed process — no longer "Guido alone."
- 2005
NumPy is born — scientific Python takes off
Travis Oliphant merges Numeric and numarray into NumPy, giving Python a truly efficient n-dimensional array. From this moment, physics, biology, and finance researchers begin migrating to Python en masse — laying the foundation for the deep-learning wave a decade later.
- 2008
pandas — the data-science gateway
Wes McKinney, frustrated with Excel + R at the hedge fund AQR, starts pandas — an R-style DataFrame on top of NumPy. Released to PyPI as 0.1 in 2009. Today roughly 80% of all data-analysis code on Earth touches it.
- 2008·12
3.0 — intentionally backward-incompatible
December 3. Python 3.0 ("Py3K") is the first deliberate backward-incompatible release:
printbecomes a function, strings default to Unicode, integer division/changes semantics. The community splits in two; reunification takes 12 years. - 2014
Project Jupyter — IPython evolves
The interactive shell IPython, created by Fernando Pérez during a 2001 PhD afternoon, grows a browser notebook in 2011 and forks into Project Jupyter in 2014 (the name nods to Julia / Python / R). "Code + prose + figures" as an executable paper becomes the science-world default — GitHub now hosts ~10 million
.ipynbfiles. - 2015·09
3.5 — type hints (PEP 484)
September 13. Guido personally drives PEP 484:
def f(x: int) -> str:. Mocked at the time as "Python turning into Java," it underpins mypy, pyright, FastAPI, pydantic, and LangChain a decade later. PEP 484 is the most underrated Python decision of the 2010s. - 2016
PyTorch / TensorFlow lock in Python
Google open-sources TensorFlow in 2015; Facebook open-sources PyTorch in late 2016. Both pick Python as the primary API. Deep learning becomes synonymous with Python — researchers want NumPy-style code, not C++ templates.
- 2018·07
Guido steps down as BDFL
July 12. After the bruising PEP 572 fight (the walrus operator
:=), Guido resigns as Benevolent Dictator For Life with a tired farewell. By December the community votes to install a five-seat Steering Council. Guido remains a member for the first year. - 2020·01
Python 2 EOL
January 1. Python 2.7 is officially end-of-life; the pythonclock.org countdown hits zero. From the 3.0 release to 2 EOL: 12 years. Lesson learned — Python has not attempted a breaking release since.
- 2021
Microsoft hires Guido · Faster CPython
Microsoft brings Guido out of retirement to lead the Faster CPython team under Mark Shannon. Goal: 5× speedup over five releases. Python 3.11 (2022) lands the first installment — ~25% average, up to 60% in some workloads.
- 2023·07
PEP 703 accepted — GIL becomes optional
Sam Gross's PEP 703 proposes making the 30-year-old Global Interpreter Lock optional, via biased reference counting and fine-grained locking. The Steering Council formally accepts it in July. The biggest internal CPython refactor in its history.
- 2024·10
3.13 — experimental free-threaded build
October. Python 3.13 ships with the first official
python3.13t("threaded") binary, GIL disabled, true multi-threaded parallelism. The cost: ~40% slower single-threaded — to be recovered in 3.14 / 3.15 over a five-year roadmap. - 2025
SO #2 used · GitHub #2 contributors
Stack Overflow 2025: Python +7 percentage points year-on-year — the largest single-year jump in a decade. GitHub Octoverse 2025: TypeScript narrowly overtakes Python by ~42k contributors, with Python still up +48% YoY. Python isn't shrinking — the AI era simply has two winners now.
Language essentials : PythonAlphabet
Python's "engineering-grade" features were grafted in slowly across versions. The eight items below are the core that any non-trivial Python project relies on.
Dynamic typing + duck typing
Variables have no types; functions don't filter arguments by type. If the right method exists, it works.
def quack(x):
return x.quack()
# A duck works,
# so does anything with .quack()
# No need to inherit from DuckList / dict / set comprehensions
One line for "filter + transform + collect" — far more readable than nested map + filter.
squares = [x**2 for x in range(10) if x%2]
# [1, 9, 25, 49, 81]
name_to_id = {
u.name: u.id
for u in users
if u.active
}Decorators @
A higher-order function that wraps another function in place. Flask, FastAPI, and pytest are built around this single idea.
@app.route("/api/users")
@cache(ttl=60)
def list_users():
return db.query(User).all()
# One line for routing, one for cache
# No XML config, no Servlet base classContext managers with
Acquire-then-release made hard to get wrong. Files, locks, transactions, temp directories, HTTP sessions — all use the same pattern.
with open("x.txt") as f:
data = f.read()
# Auto-close on exit, even on exception
with db.transaction():
db.execute(...)
# exception = rollback, normal = commitGenerators + iterators
yield turns a function into a pausable iterator. Streaming data, huge files, infinite sequences — never blow up memory.
def read_lines(path):
with open(path) as f:
for line in f:
yield line.strip()
# A 100GB log uses just a few KB
for line in read_lines("huge.log"):
process(line)Type hints (3.5+)
Optional annotations, not enforced at runtime, but consumed by mypy / pyright / IDEs. pydantic and FastAPI also use them as a schema.
def greet(name: str, n: int = 1) -> list[str]:
return [f"hello {name}"] * n
# Drives go-to-def, autocomplete, errors
# PEP 484 (3.5) → 585 (3.9) → 695 (3.12)
# A decade-long path to de-facto standarddataclasses · immutable
Built in since 3.7. No more hand-writing __init__ / __repr__ / __eq__.
from dataclasses import dataclass
@dataclass(frozen=True)
class User:
name: str
age: int = 0
u = User("Anders", 64)
# Auto __init__ / __eq__ / __hash__
# frozen=True → immutableasync / await
Coroutine syntax since 3.5. One event loop drives thousands of concurrent IO operations — no threads, no processes. FastAPI, aiohttp, Playwright Python all rely on it.
async def fetch(url):
async with session.get(url) as r:
return await r.text()
results = await asyncio.gather(*[
fetch(u) for u in urls
])
# 1000 concurrent requests, one processWhy use : WhyPython
Python is not the fastest, the most rigorous, or the trendiest. But on the path from idea to result, its total elapsed time has been the shortest for years.
Idea to result in 15 minutes
No project scaffold, no compile step, no type-system gymnastics. Want the top 10 IPs in a 100GB log? Four lines using collections.Counter. Few languages can match Python at the prototype stage.
from collections import Counter
Counter(open(f)).most_common(10)Reads like pseudocode
Python looks like executable pseudocode. Guido's principle — "code is read more often than written" — is why algorithm textbooks, CS101 courses, and academic paper appendices use it.
if x in cache:
return cache[x]
# Needs no further explanationKing of science / data / AI
NumPy, pandas, SciPy, scikit-learn, matplotlib, PyTorch, JAX, Hugging Face — all Python first. A 20-year moat that no newcomer will fill in the short term.
import torch
model = AutoModel.from_pretrained(...)
# 3 lines to load and run a 7B modelGlue language to C / C++ / Rust
Slow code paths offload to C extensions, Cython, or PyO3. Python is the API surface; the hot loops run in any fast language. NumPy, PyTorch, pandas all do this — write 80% in Python, run at 100% native speed.
# On the surface — Python:
a @ b
# Underneath — BLAS / cuBLAS / MetalPyPI · 600k+ packages
From OCR to Bitcoin, from genetic algorithms to LaTeX rendering — whatever your domain, someone has shipped a PyPI package. pip install handles it; with uv it's now faster than npm.
pip install requests pandas torch
# Scraper + tables + AI in three packagesThe teaching lingua franca
MIT, Berkeley, and most major CS programs use Python as their first language. Automate the Boring Stuff is the book your accountant cousin can read. "Learning to code" essentially means learning Python for an entire generation.
# Day-one program for a 7th grader:
print("Hello, world!")
# No need to explain main / class / publicCross-platform native
The same .py runs on Linux, macOS, Windows, BSD, Raspberry Pi, even iOS via Pyto. For scripting tools you don't ship multiple binaries.
# Author on macOS
# Coworker clones on Windows
# Deploy to Linux via systemd
# One source, three platformsThe REPL — ask the program
Type python and you're in an interactive shell. Don't know an object? dir(x). IPython and Jupyter doubled down on this culture — analysts spend 80% of their time in the REPL.
>>> dir(obj)
>>> help(x)
# Don't look it up — ask the objectStable governance via PSF
A five-seat Steering Council, elected annually. Public PEP discussions. 30+ years without a fork, schism, or "founder leaves in protest" — almost unheard of in open source.
# Anyone can submit a PEP
# Big changes go through full debate
# No 'founder veto' any moreWho uses it : ProductionUsers
Python is the lingua franca of AI labs, the SQL-replacement of choice for data teams, the script glue at observatories, a NASA submodule, and the Instagram back-end. The 12 projects below span LLM frameworks, web stacks, and scientific visualization.
The AI / data-science era : Python
After being chosen by Google and Meta in the 2010s, Python's path through scientific computing narrowed and deepened. Today it is the native tongue of AI researchers, the API of nearly every training and inference framework, and the de-facto reproducible-paper format via Jupyter — three roles in one language.
"Python won in scientific computing and AI because it does not force a single coding style. You can hack a prototype line by line, or layer abstractions up to industrial grade. Researchers want a language as close as possible to the math in their head; they don't care about the GIL or single-thread speed because NumPy already pushes the hot loops down to C.
Linux Foundation 2024 survey: 63% of training pipelines, 70% of research implementations, and 55%+ of NeurIPS/ICML papers use PyTorch. TensorFlow and JAX share the rest. All three are Python first.
GitHub holds nearly 10 million .ipynb files: paper reproductions, tutorials, Kaggle solutions, AI primers — almost all of them. Nature in 2021 listed Jupyter among the "ten codes that transformed science."
Stack Overflow 2025: Python grew by +7 percentage points year-on-year — its largest single-year jump in a decade. The cause is obvious: the AI wave funneled everyone wanting to touch ML toward Python.
PyTorch
Open-sourced by Facebook AI Research in late 2016 as an internal "NumPy + autograd" experiment. Overtook TensorFlow in popularity by 2018; donated to the Linux Foundation in 2022 for independent governance.
- Dynamic graph — what you write is what runs; debugging feels like normal Python
- autograd — automatic differentiation; tensors carry a gradient tape
- torch.compile — JIT compilation in 2.0+, approaching hand-written CUDA
- 5T inferences / day — across 50+ Meta data centers
"Researchers translate papers in their head straight into PyTorch; engineers ship that PyTorch to production." Of 1M+ models on Hugging Face, the vast majority are .pt weights.
# A complete training loop in three blocks
import torch
import torch.nn as nn
model = nn.Sequential(
nn.Linear(784, 128),
nn.ReLU(),
nn.Linear(128, 10),
)
opt = torch.optim.Adam(model.parameters())
for x, y in loader:
loss = F.cross_entropy(model(x), y)
loss.backward()
opt.step()
# 90% of deep-learning code looks like this
# Copy from a paper, ship to productionAI / data stack · Python first, by default
Tooling rewritten in Rust
Python is not winning everything. Over the past three years, layer after layer of Python tooling has been rewritten in Rust — paradoxically reinforcing the application-layer Python moat while exposing the limits of "tooling written in pure Python."
Astral (acquired by OpenAI in March 2026) ships ruff, a single Rust binary that replaces Flake8, Black, isort, pyupgrade, and pydocstyle — tens to hundreds of times faster. uv rewrites pip, pip-tools, virtualenv, pipx, poetry, and pyenv, and runs faster than npm.
Elsewhere, Polars (Rust DataFrame) is encroaching on pandas; Pydantic v2 moved its validation core into Rust for a 5–50× speedup. The pattern: hot paths increasingly belong to Rust, but the user-facing API stays Python — exactly which proves Python's role as the "scientific application layer" is secure.
# Install / sync / run a project with uv:
$ uv init my-llm-app
$ uv add torch transformers fastapi
$ uv sync # 80× faster than pip
$ uv run main.py
# Lint + format, all in ruff:
$ ruff check . --fix
$ ruff format .
# Replaces Black + isort + flake8 + pyupgrade
# Used to require 4 tools in sequence,
# now one binary in under a second.
# On the surface — still your .py files
# Underneath — the toolchain is Rust nowBottom line: the AI wave did not erode Python's position — it pushed Python to its career peak. Rust is taking the toolchain, TypeScript is taking GitHub's #1 slot, but for training models, writing papers, and teaching beginners there is no near-term challenger.
Compare : Python / JS / R
Three "dynamic, interpreted, broadly used" languages, but their ecosystems took completely different paths.
| Python | JavaScript | R | |
|---|---|---|---|
| Born | 1991 · Guido | 1995 · Brendan Eich · 10 days | 1993 · Univ. of Auckland |
| Primary domain | AI / data / scripting / back-end / teaching | Browser + Node + cross-platform | Statistics / academic plotting |
| Typing | Dynamic · optional type hints | Dynamic · TS adds static layer | Dynamic · very weak |
| Style | Indent · pseudocode-readable | Braces · flexible but prone to traps | <- assign · formula DSL |
| Package mgr | pip / uv · 600k+ on PyPI | npm · 2M+ | CRAN · 20k+ academic |
| Numerics | NumPy / pandas / Polars | danfo.js / arquero (catching up) | Built-in — data.frame in core |
| Deep learning | PyTorch / TF / JAX live here | TensorFlow.js / ONNX (inference) | keras through a Python bridge |
| Stat modeling | statsmodels / pingouin | ~none | Lead · ggplot / lme4 / Stan |
| Notebook culture | Jupyter (~10M repos) | Observable / Deno notebooks | R Markdown / Quarto |
| Performance | Interpreted · slow · 3.13t experimental no-GIL | V8 JIT · single-threaded model | Interpreted · slow · rarely a hot path |
| 2025 ranking | SO #2, Octoverse #2 | SO #1 | Sliding · still strong inside academia |
| AI-era role | Native tongue of research / training / inference | App layer / front-end / agent tools | Statistical inference still relevant |
The road ahead : TheRoadAhead
Three big tracks are running in parallel: dismantling the GIL, accelerating CPython, and handing the toolchain to Rust. Each is a five-year project.
PEP 703 / Free-threaded Python
Three decades of GIL finally see an exit. Sam Gross's PEP 703 introduces biased reference counting and per-object fine-grained locking, enabling true multi-threaded parallelism. 3.13 experimental, 3.14 maturing, 3.15+ default-capable — a five-year refactor.
Cost: ~40% slower single-threaded today (improving fast). But for ML inference, numerical parallelism, and many-core servers it's a phase change — instead of multiprocessing-cloning a multi-GB model, one process can saturate 64 cores.
Faster CPython · 5× over 5 years
Mark Shannon's Microsoft team aims for cumulative 5× speedup from 3.10 to 3.15. 3.11 delivered ~25%; 3.12 / 3.13 build on the specializing interpreter, tier-2 optimizer, and a JIT prototype. No code changes required from users.
Astral acquired by OpenAI · uv / ruff
March 2026: OpenAI acquires Astral, folding uv (80× faster than pip) and ruff (100× faster than Flake8) into the Codex team. Rustification of Python tooling is now effectively irreversible.
SO 2025 · +7pp
Python's largest single-year jump in a decade, driven directly by the AI wave. With 81% of developers using AI tooling and every AI SDK leading with a Python client, the funnel converges on Python.
Research-to-production bridge stable
Researchers used to write PyTorch and engineers rewrote it in C++ for production. With torch.compile + vLLM / TensorRT-LLM, PyTorch runs as-is in production. "Research language = engineering language" — Python's deepest moat.
The next generation's first language
US and European CS101 courses are largely Python; China's NOI olympiad now accepts Python; MIT 6.0001 and Berkeley CS61A are both Python-based. Whoever learns to code next, their first Hello, world! is most likely print().