Chapter 1. The Story of Python

In December 1989, a Dutch programmer called Guido van Rossum was looking for a “hobby” project to keep him occupied over his Christmas holiday. He decided to write an interpreter for a new programming language he’d been thinking about. He states that he was in a slightly irreverent mood so he decided to call his project “Python” after the famous British comedy troupe, “Monty Python’s Flying Circus.”1

Van Rossum goes on to explain:

It all started with ABC, a wonderful teaching language that I had helped create in the early eighties. It was an incredibly elegant and powerful language, aimed at non-professional programmers. Despite all its elegance and power and the availability of a free implementation, ABC never became popular in the Unix/C world. I can only speculate about the reasons, but here’s a likely one: the difficulty of adding new “primitive” operations to ABC. It was a monolithic, “closed system,” with only the most basic I/O operations: read a string from the console, write a string to the console. I decided not to repeat this mistake in Python.

Perhaps this explains why Python is so popular in education: from the beginning, it was derived from a language designed for teaching and aimed at nonprofessional programmers. Yet by making it an open and extensible platform (Python is an open source project), Python could grow into the hugely popular and flexible language it is today, capable of simply and effectively addressing many different types of computational problems.

Van Rossum is now the Benevolent Dictator For Life (BDFL) for the Python language and continues to make core contributions to the language along with many thousands of developers spread all over the world. From such curious beginnings, Python has grown to be a major open source software project. Why? What is it about Python that has made it so successful? What are the guiding principles that attract such a large group of programmers, both amateur and professional, to work with and contribute to Python?

A handy answer is the Zen of Python. Its author, Tim Peters, describes it as a document that “succinctly channels the BDFL’s guiding principles for Python’s design into 20 aphorisms, only 19 of which have been written down.”

To read the Zen of Python, one simply starts the Python interpreter and types the command import this:

>>> 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.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious
way to do it.
Although that way may not be obvious at first unless
you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!

While much of this cultural artifact won’t make sense to nonprogrammers, the general sense—which should be obvious to all—is a striving for simplicity, clarity, pragmatism and a sense of playful fun. Contrast this outlook with the usual stereotypes of programming languages as complex, obscure, dense and serious endeavours. It’s hard not to wonder about Python, “What’s not to like?”

As Alex Martelli puts it in his Python Cookbook (O’Reilly), “To describe something as clever is not considered a compliment in the Python culture.”

Python culture? Yes, there is a Python culture that labels positive aspects of Python programming as “Pythonic.” A simple, elegant and easy-to-comprehend solution to a programming problem (i.e., it conforms to the Zen of Python) will often be called Pythonic.

Python’s focus on simplicity, clarity, pragmatism and fun is appealing in an engineering context. I believe it is also essential and attractive in the world of education. After all, engaging young coders with a text-based programming language puts up plenty of barriers to entry (learning to type accurately, underdeveloped literacy and comprehension skills and a lack of syntactic discipline when writing spring immediately to mind). This is before even having to deal with the complexity of the language itself, its idioms and abstractions.

Python’s potential role in the world of education was not missed by Van Rossum. In 1999, he made his position on the subject public through a proposal for a project called “Computer Programming for Everybody: A Scouting Expedition for the Programmers of Tomorrow”. The opening paragraphs of the proposal succinctly describe his outlook:

In the seventies, Xerox PARC asked: “Can we have a computer on every desk?” We now know this is possible, but those computers haven’t necessarily empowered their users. Today’s computers are often inflexible: the average computer user can typically only change a limited set of options configurable via a “wizard” (a lofty word for a canned dialog), and is dependent on expert programmers for everything else.

We ask a follow-up question: “What will happen if users can program their own computer?” We’re looking forward to a future where every computer user will be able to “open the hood” of their computer and make improvements to the applications inside. We believe that this will eventually change the nature of software and software development tools fundamentally.

The project planned to have three components. They intended to:

  1. Develop a new computing curriculum suitable for high school and college students.
  2. Create better, easier-to-use tools for program development and analysis.
  3. Build a user community around all of the above, encouraging feedback and self-help.

The results of the project’s endeavors were to come together in a scientific exploration of the role of programming in the next generation of computing environments. The proposal continues:

We intend to start with Python, a language designed for rapid development. We believe that Python makes a great first language to learn: Unlike languages designed specifically for beginners, Python is also the choice of many programming professionals. It has an active, growing user community which has already expressed much interest in this proposal, and we expect that this will be a fertile first deployment ground for the teaching materials and tools we propose to create. During the course of the research we will evaluate Python and propose improvements or alternatives.

Exploring how learners used Python was going to inform the development of new programming languages and tools. These opening paragraphs also beautifully encapsulate Python’s strengths in the context of education.

Unfortunately the project was never finished due to a lack of funding. I find it an interesting (and rather frustrating) “what if?”. How might Python and computing education have developed if the project had delivered on all three of the planned components?

In any case, this is yet more evidence of how Python has always had education as a core focus. The proposal also appears prescient given the recent changes in attitude to the computing curriculum and the promotion of programming. Van Rossum was a decade and a half too early. Could such a project be revived today?

Nevertheless, such educational endeavors did not go unnoticed. Projects concerned with computing and education have successfully made use of Python to great effect. For example, the One Laptop Per Child (OLPC) project has the following aim:

We aim to provide each child with a rugged, low-cost, low-power, connected laptop. To this end, we have designed hardware, content and software for collaborative, joyful, and self-empowered learning. With access to this type of tool, children are engaged in their own education, and learn, share, and create together. They become connected to each other, to the world and to a brighter future.

The user interface and applications for the OLPC were written in Python. Over 2.5 million children and teachers in 42 countries have such laptops.

Perhaps the most famous and successful computing-in-education project in history is the Raspberry Pi (with over 5 million devices delivered so far). Unsurprisingly, Python is at the heart of the project. The next chapter is a case study exploring why the Raspberry Pi Foundation chose to focus on Python and how this has led to some unexpected yet wonderful outcomes.

1 From the foreword to Mark Lutz’s book Programming Python (1st ed.), published by O’Reilly.

Get Python in Education now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.