typestar

Languages

Python

The language that optimizes for the reader, and won the sciences by doing it.

First released
1991
Created by
Guido van Rossum
Typing
Dynamic and strong, with optional static annotations
File extensions
.py

What it is for

Python is what you reach for when your time costs more than the computer's. It runs data analysis, scientific computing and machine learning almost by default. It is a first choice for automation and glue. It holds up a good deal of the web's back end. Almost none of that was planned. Python spread because reading it is easy, and code gets read far more often than written.

The trade is out in the open. Python is slow where it matters least. A loop over a million items in pure Python is dismal, but that loop usually is not written in Python at all: NumPy, pandas and PyTorch push the arithmetic down into C, Fortran and CUDA. Python is left naming things, arranging them, and staying out of the way.

Then there is the standard library. A working install already speaks JSON, CSV, SQLite, HTTP, subprocesses, dates and paths, and PyPI holds most of what it does not. For a lot of problems the answer really is a dozen lines and one import.

Where it came from

Guido van Rossum started Python over the Christmas break of 1989 at CWI in Amsterdam, as a successor to a teaching language called ABC. Version 0.9.0 went out in February 1991. ABC's goal, that a language should read well and teach well, is the one thing Python never gave up. Significant whitespace is the most visible consequence.

Python 2.0 arrived in 2000 with list comprehensions and a garbage collector. Python 3.0 followed in 2008 and broke compatibility on purpose to fix text: strings became Unicode, bytes became their own type, print became a function. The migration took over a decade and hurt enough to become a cautionary tale told in other language communities. Python 2 was finally retired in 2020.

What came after the split was a long, quiet run of consolidation. F-strings, async/await, dataclasses, structural pattern matching, and a gradual typing system the whole ecosystem now leans on. Van Rossum stepped down as Benevolent Dictator For Life in 2018, worn down by the reception to the walrus operator, and an elected Steering Council has run the language since.

What it is like to type

Python is a pleasure to touch-type and unforgiving if you get sloppy. Few braces, almost no semicolons, so your hands stay on words rather than symbols. But the indentation is the syntax. Four spaces is a real keystroke with real consequences. Colons closing every block opener, underscores in the middle of every name, and the double-underscore dunders are the drills that pay off.

Practice Python

364 steps across 13 tours, from the basics to complete programs.

The tours

Official documentation

Other languages