Sticker 013 · Back to Guido van Rossum’s sticker · Leggi la versione italiana
In Python, moving a line a few spaces can change what the program does. The indent tells the reader and the interpreter which block the line belongs to. It is a defining choice in the language Guido van Rossum began designing in December 1989 at CWI in Amsterdam. He wanted a tool with the readability of ABC that could also be extended to work with a real operating system. CWI’s account of Python’s origins · Van Rossum’s own account.
From ABC and Amoeba to the first public Python
Van Rossum had worked on the ABC language. In his account of Python’s origins, he describes what he liked about ABC’s syntax and high-level data types. His group at CWI also needed to write programs for Amoeba, a distributed operating system. The new language could retain some of ABC’s ideas and connect to other software through modules and extensions. Van Rossum began writing the interpreter over Christmas 1989. The earliest public versions circulated on Usenet in February 1991. Van Rossum’s original post to alt.sources.
Why indentation matters
Imagine adding up a list of expenses. Put the line that adds an amount inside the loop and it runs for every expense. Put the line that shows the total outside the block and it runs once, at the end. Indentation makes the distinction visible to the reader, and the interpreter uses it to work out where blocks start and end. Lists and dictionaries, which represent sequences and key–value associations, also let you describe many problems without building the underlying data structures yourself. Python’s language reference on indentation.
Guido van Rossum’s original code in Python 0.9.1
Here is a historical excerpt from lib/string.py in Python 0.9.1. The initial Lib/string.py commit, dated October 1990, records Guido van Rossum adding this code. The lower function walks through the input. For each ASCII capital from A to Z, it looks up the corresponding lowercase letter in _caseswap and builds the result. The lookup table appears elsewhere in the module. This excerpt reproduces the historical source. Module in the Python 0.9.1 archive · Initial commit in the CPython repository.
def lower(s):
res = ''
for c in s:
if 'A' <= c <= 'Z': c = _caseswap[c]
res = res + c
return res
Code by Guido van Rossum. The Stichting Mathematisch Centrum copyright and reuse terms appear below as printed in the historical release README.
CWI copyright and licence notice
Copyright 1991 by Stichting Mathematisch Centrum, Amsterdam, The
Netherlands.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Stichting Mathematisch
Centrum or CWI not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior permission.
STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.How Python became a shared project
Python 3.0 was released on 3 December 2008 and introduced changes incompatible with the 2.x series. One example is the distinction between Unicode text (str) and sequences of bytes (bytes). When reading files or communicating across a network, it makes the point at which bytes must be decoded as text explicit. Python’s maintenance now depends on CPython contributors, the work of the Python Software Foundation and the core developers’ decision-making process. PEP 13 sets out an elected steering council. Python 3.0 release · Text and bytes in Python 3.0 · Python Software Foundation · PEP 13.
Featured image. Original AI-generated editorial illustration for this sticker.
Nominate a programmer for the album
Who has made an outstanding contribution to software? We welcome nominations for well-known and lesser-known programmers. Give us a name, a specific project or contribution and sources we can check. An email address is optional and helps if we need clarification. The editors review each nomination before deciding whether to publish it.
