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.”
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
- 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.
NB: This excerpt was taken from the book titled Python in Education with permission from the author, Nicholas H. Tollervey