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.
364 steps across 13 tours, from the basics to complete programs.
The tours
- Language basicsEverything you need before the interesting parts. 72 steps.
- Pythonic PythonThe difference between Python that works and Python that reads like Python. 53 steps.
- Domain toolsThe standard library doing real jobs. 41 steps.
- NumPyNumPy is the layer nearly every scientific Python library is standing on, and the array is the only idea in it. 22 steps.
- PolarsPolars is the dataframe library that took the lessons from pandas and started again in Rust. 32 steps.
- Web scrapingNine steps, two libraries, one honest warning. 9 steps.
- Testing with pytestpytest with the assert statement doing the work, which is most of why people use it. 9 steps.
- pandasThe dataframe library that made Python a serious option for data work, and the one whose API you will be reading in other people's notebooks for years. 26 steps.
- Machine learning with scikit-learnscikit-learn's real contribution is the estimator API: fit, predict, transform, and the fact that every model in the library obeys it. 25 steps.
- Plotting with matplotlibmatplotlib is old, enormous, and still what most scientific figures are made of. 14 steps.
- Web services & data accessWhat a Python web service looks like in practice now. 19 steps.
- Scientific computing with SciPySciPy is what you use once NumPy runs out. 23 steps.
- Statistics with statsmodelsWhere scikit-learn predicts, statsmodels explains. 19 steps.
Official documentation
- The Python documentation
- The language reference
- The standard library
- PEP index (the design record)
- PyPI, the package index