What kind of language it is
Python is a general-purpose language: a program isn’t compiled in advance; the python interpreter executes the text
file. The central idea behind its design is that code is read more often than it’s written. So blocks are marked by
indentation rather than braces, there are few special symbols, and the everyday things are already in the standard
library. The language says so outright — it has a built-in manifesto:
python -c "import this"
# The Zen of Python, by Tim Peters
#
# Beautiful is better than ugly.
# Explicit is better than implicit.
# Simple is better than complex.
# Complex is better than complicated.
# Flat is better than nested.
# Sparse is better than dense.
# Readability counts.
What that looks like in practice — the five most common words in the Python license text:
from collections import Counter
words = open("license.txt", encoding="utf-8").read().lower().split()
print(Counter(words).most_common(5))
# [('the', 189), ('of', 121), ('or', 119), ('and', 97), ('in', 84)]
In C the same thing means your own hash table, memory allocation and string parsing by hand — several dozen lines. Python is slower than C, but a programmer’s time costs more than processor time, and the language grew on that trade-off.
Indentation instead of braces is a final decision, and this is how the interpreter answers a request to bring braces back:
python -c "from __future__ import braces"
# SyntaxError: not a chance
The name isn’t from the snake. Guido van Rossum, the language’s author, was reading the scripts of “Monty Python’s
Flying Circus” at the time and wanted a short, slightly mysterious name. That’s why the documentation’s examples are
called spam and eggs rather than foo and bar, and import antigravity opens the xkcd comic about Python in the
browser.
How Python became the leader — and where it didn’t
The leading language changed with the leading task: sites on shared hosting, then data, then neural networks. In each era the winner was whoever made that task easiest.
1989–2000: a sysadmin language between C and shell
Guido was working at the Dutch institute CWI on the Amoeba distributed OS. Administering it meant either C programs — slow to write — or Bourne shell scripts — awkward as soon as the task grew past a couple of commands. He wanted a language in between: as readable as ABC, the teaching language he had worked on earlier, but extensible and with access to the system. He started over the Christmas holidays of 1989 and posted it to USENET in February 1991. From ABC came indentation and built-in lists and dictionaries. C extensions were in the language from the start — that would pay off 15 years later.
2000–2010: websites are written in PHP, Python stays with the admins
The web of that era was PHP. The reason wasn’t the language but hosting: the mod_php module was built into Apache on
any cheap host, you uploaded a .php file over FTP, and it worked. Python for a website needed a permanently running
process: the WSGI standard appeared in 2003, Django in 2005, but they needed a server of their own and an administrator
(Web servers since 2008).
Python took a different niche — scripts and automation, where Perl used to rule. Perl had a reputation as a “write-only language”: quick to write, hard to read six months later, while Python reads like text. From 2005 to 2012 Guido worked at Google, where Python was one of the main languages. Big sites in it appeared too: Instagram grew up on Django.
At the end of 2008 Python 3 came out, incompatible with version 2. The most visible change — print "x" became
print("x") — meant millions of lines of code had to be rewritten. The move took 11 years: Python 2 support ended on
January 1, 2020.
2006–2015: data moves to Python
Scientists and analysts worked in MATLAB — which is paid — and R, where a statistical test is one line but a web request or file handling is already a chore. A free toolkit formed around Python: NumPy (2006) for arrays, pandas (2008) for tables, scikit-learn for machine learning, IPython notebooks, which became Jupyter in 2014. The C extensions won it: heavy computation runs in compiled code, and Python handles everything around it — download the data, clean it, plot it, publish the result. One language for the whole path instead of three.
2015–2026: neural networks
In November 2015 Google open-sourced TensorFlow, and Facebook followed with PyTorch — both Python on the outside and C++ and CUDA inside. Researchers were already on NumPy and Jupyter, and the new libraries came to where the users already were. Then the snowball rolled: code for new models gets published in Python, so the next project starts in it too. In October 2021 Python topped the TIOBE ranking for the first time — before that only C and Java had been first.
In 2018 Guido himself gave up the title of “Benevolent Dictator for Life” — after a dispute over a single operator,
:=. Since then the language has been run by an elected council of five.
Who leads in 2026
There’s no single king — each task has its own:
| Task | Leader | Why |
|---|---|---|
| Websites | PHP | per W3Techs as of 2026-10-21, 69.3% of sites with a known server-side language; WordPress alone is 39.6% of all sites. Python has 1.1%; its backends usually hide behind an API and aren’t visible from outside |
| The browser | JavaScript, TypeScript | there are no other languages in the browser. Per GitHub Octoverse 2025, TypeScript overtook Python in number of contributors in August 2025 |
| Data and AI | Python | NumPy, pandas, PyTorch and the code for models |
| Infrastructure | Go | Docker, Kubernetes, Traefik, CrowdSec and Caddy are written in it |
| Systems, engines | C, C++, Rust | OS kernels, browsers, databases, PyTorch’s internals |
| Enterprise systems | Java, C# | banks, accounting, large teams with long support cycles |
Why a slow language computes neural networks
A loop in pure Python
c = [[sum(a[i][k] * b[k][j]
for k in range(N))
for j in range(N)]
for i in range(N)]300 × 300 matrices — 2.4 s. The interpreter performs each of the 27 million multiplications itself.
The same with NumPy
c = a @ bThe same matrices — 5–12 ms, 200–500 times faster, with the same result. C code optimized for the processor does the multiplying; Python only hands it the matrices.
All AI in Python works this way: PyTorch hands the computation to the GPU through CUDA, and Python keeps what changes most often — the model’s structure, the data, the training loop.
text in the editor
- Script
train.pyAn ordinary text file. Indentation is part of the syntax: it marks what’s inside a loop, a condition, a function. - Interpreter
python train.pyThepythonprogram reads the file and executes it line by line. There’s no build step: fix it and run it again. - Standard library
import pathlibModules that come with Python: files and paths, networking, archives, JSON, randomness for passwords. - Packages
pip install torchEverything else, from the PyPI index: NumPy, pandas, PyTorch, Django. Install them into the project’s virtual environment. - C, C++, CUDA code
a @ bHeavy packages have compiled code inside. Python calls it like its own function, and it computes on the CPU or the GPU.
the result: files, an answer, a trained model
In a training loop CUDA code runs almost all the time, and Python issues the next command between calls — so a slow interpreter doesn’t slow training down.
Where it’s used
AI and models
PyTorch, TensorFlow, JAX for training; Hugging Face Transformers for ready models; vLLM for running models on a server. Model API SDKs are in Python too (First API request).
Data and science
NumPy for arrays, pandas for tables, Jupyter — a notebook where code, charts and conclusions sit side by side.
Website backends
Django — a site with an admin panel and a database out of the box; FastAPI — an API with data validated by types.
Servers and automation
Ansible and cloud-init are written in Python (cloud-init); Ubuntu ships it out of the box because system
utilities run on it. The language’s roots are here.
Scripts for yourself
Files, photos, passwords, site checks: a task for an evening and a working result — this set’s steps.
Why a model writes a script instead of doing it itself
An agent asked to rename 2,000 photos by date doesn’t rename them one by one — it writes a 15-line script and runs it once. That’s cheaper and more accurate, for three reasons.
- A model is bad at mental arithmetic. It sees tokens, not letters and digits: how many r’s in a word, the sum of a column, a string’s length are frequent misses (Where models fail). A script counts exactly, so “count it in code” is a request that works.
- Intermediate data doesn’t go through the model. Every tool call is a question and an answer in the context, i.e. tokens and time (Agents and tools). A script walks 2,000 files inside itself and returns one summary line to the model. In Anthropic’s example (November 2025), the task “move a meeting transcript from Google Drive into Salesforce” took 150,000 tokens with direct calls and 2,000 with code. The code in that example is TypeScript, incidentally: the principle isn’t tied to a language. But when a model in a chat crunches a table or plots a chart, its sandbox usually runs Python.
- A script can be read and repeated. You check 20 lines by eye before running them, and with a dry run, the result too (Sort Downloads). Two thousand separate actions can’t be checked that way.
The practical conclusion: even if a model writes the code for you, you need to be able to read it. That’s what this set is for.
Other ways to do the same jobs
Described from documentation as of October 2026; apart from Python, none were run.
| Where it’s strongest | How it differs from Python | |
|---|---|---|
| Python | AI, data, automation, backends | reads almost like text; speed comes from C, C++ and CUDA libraries |
| JavaScript, TypeScript | everything in the browser; Node.js backends | the browser’s only language; TypeScript adds types — errors show before running, including in AI-written code |
| PHP | websites, WordPress | runs on any host without setup; rarely seen outside the web |
| Go | network services, infrastructure | builds into a single file with no dependencies, concurrency is built into the language; few AI libraries |
| Java, C# | large enterprise systems | strict types and long support cycles; more code for the same task |
| C++, Rust | engines: browsers, databases, the PyTorch core | the fastest, but several times more code and time for the same task; often a layer underneath Python |
| bash, PowerShell | commands on a server, Windows settings | glue ready-made programs together; lists, dictionaries and errors get awkward by 30 lines |
| If… | Use |
|---|---|
| models, data, automation, a script for yourself | Python |
| a browser interface or an extension | TypeScript |
| a site on shared hosting, WordPress | PHP |
| a network service or a utility people will install without Python | Go |
| a core where every millisecond counts | C++ or Rust, often with Python on the outside |
| three to five commands in a row on a server | bash |
What you get and what it costs
What you get
- A result on the first evening. No build step, and files, networking and passwords are in the standard library.
- One language from script to model. The
import, functions and dictionaries from this set’s first steps are the same ones in training code. - One script on every system.
pathlibpicks\or/in paths itself; the same file works on Windows and on a server. - An error tells you where it broke. The output on a crash names the file, the line and the cause:
FileNotFoundError: [Errno 2] No such file or directory: 'notes.txt'.
What it costs
- Your own loop in Python is slow. On matrices it’s 200–500 times slower than NumPy. Compute with a library, not your own loops; in scripts for files and networking you won’t notice — they wait on the disk and the network.
- One thread computes at a time. The global interpreter lock (GIL) keeps threads from running Python code in parallel; since 3.13 there’s a build without it, and libraries are catching up. C and CUDA code inside libraries releases the lock.
- Type errors show only at run time. Python doesn’t check in advance that a function got a number rather than a string; type hints and a
mypycheck are optional. - Python is needed wherever you run it. A script for a friend on Windows won’t run without Python; Ubuntu has it, Windows doesn’t.
- Packages conflict. Two projects want different versions of one package — which is why each gets its own virtual environment (Wi-Fi QR code).
Where to start
Start with one-evening tasks: model code uses the same concepts, and the result shows right away, no GPU needed. The tasks and chapters are collected in the Python section. Practice means working scripts: whatever you need is explained in the manual itself. The chapters go from the first run to modules and classes, one concept per chapter. The first task is Files to your phone: install Python and, with one command, open a folder for your phone on the same Wi-Fi.
If it doesn’t work
You type python, and the Microsoft Store opens
- Cause
- Python isn’t installed, and Windows substitutes a stub — an alias that leads to the store.
- Fix
- Install the Python install manager and open a new terminal window (Files to your phone).
Command 'python' not found, did you mean: command 'python3'
- Cause
- On Ubuntu the command is
python3; there’s nopythonwithout the digit by default. - Fix
- Type
python3, or installpython-is-python3.
error: externally-managed-environment on pip install
- Cause
- Ubuntu 23.04 and newer won’t let you install packages into the system Python: the system itself needs it (PEP 668).
- Fix
- Create a virtual environment:
python3 -m venv .venv, then.venv/bin/pip install ….
ModuleNotFoundError: No module named '…'
- Cause
- The package was installed into another Python: a different version, or outside the virtual environment.
- Fix
- Install with the same interpreter you run:
python -m pip install …instead of plainpip.