Norvig's lispy: beautiful and illuminating Python code

  • 07-12, 13:45–15:15, Wicklow Hall 1
  • 07-12, 15:30–17:00, Wicklow Hall 1

All times in Europe/Dublin

Why isn't if a function? Why does Python need to add keywords from time to time? What precisely is a closure, what problem does it solve, and how does it work? These are some of the fundamental questions you'll be able to answer after this tutorial: an interactive exploration of Peter Norvig's lis.py–an interpreter for a subset of the Scheme dialect of Lisp in 132 lines of Python.


Peter Norvig of Stanford University wrote lis.py: an interpreter for a subset of the Scheme dialect of Lisp in 132 lines of readable Python. I took Norvig's code, updated it to modern Python coding style, and integrated it into a Jupyter notebook that provides explanations as well as interactive experiments and exercises checked automatically.

Why should you study lis.py? This is what I got out of it:

  • Learning how an interpreter works gave me a deeper understanding of Python and programming languages in general—interpreted or compiled.

  • The simplicity of Scheme is a master class of language design.

  • lis.py is a beautiful example of idiomatic Python code.


Expected audience expertise: Domain

none

Expected audience expertise: Python

some

Abstract as a tweet

Norvig's lis.py: a Scheme interpreter in 132 lines of readable Python code. Let's see how a language works!

Luciano Ramalho is the author of Fluent Python, published in 9 languages. He is a Principal Consultant at Thoughtworks and a Fellow of the Python Software Foundation.

This speaker also appears in: