Grant Jenks Logo

Fight Night in Literate Python

I want to tell you a story about two titans of computer programming: Donald Knuth and Doug McIlroy. Thirty years ago these titans dueled when McIlroy challenged Knuth to a competition: parse the words in a file, tally the frequency of each word, and display the top ten most frequently occurring words. By today’s standards, it’s an interview question. But thirty years ago, it was a problem worthy of publishing. And the solutions of these two titans were widely distributed by the Programming Pearls magazine.

The problem was interesting but more was at stake. Each titan wanted to promote a style of programming and answer the question: What should programming look like? Knuth’s solution was to promote Literate Programming, a style that combines the source code, documentation, and test cases together in one file. McIlroy’s solution was to promote Shell Programming, a style that emphasizes the re-usability and composability of simple programs.

These styles now represent extremes and between them lies Python. Together we’ll look at an idiomatic Python solution and discuss a couple sayings in the community: “the core developers read Knuth so that you don’t have to” and “simple is better than complex is better than complicated.” The results of the challenge have influenced Python’s syntax, built-in functions, and standard library modules. Join for a fun tale and important piece of history.