Login Sign up

Thursday Oct. 15, 2020, 5:30 p.m.–Oct. 15, 2020, 6 p.m. in Jupyter Community: Practices

Dr. Schmood's Notebook of Python Calisthenics and Orthodontia

David Schmudde

Audience level:
Intermediate

Brief Summary

Explore the benefits of taking a functional approach when writing Python in Jupyter notebooks: reduce errors caused by out-of-order execution and hidden state while producing more readable code.

Outline

"Programs should be written for people to read, and only incidentally for machines to execute." - Abelson and Sussman, Structure and Interpretation of Computer Programs

The linear nature of computational notebooks are a natural fit for telling the story of your code, data, and results. However, this format underpins an essential tension between the format's implied linearity and the computer's ability to access, process, and display information in any order. Functional approaches offer an idiosyncratic way of navigating the issue. For example, treating a cell as a collection of small pure functions and eliminating mutable global state make results more immediate and errors easier to understand.

This talk will explain functional programming using practical language and provide historical context. Some initial concepts will be demonstrated in Clojure or Julia, but ultimately translated to Python. Further consideration will be given to the impact of immutability, a core concept in the functional style, on creating reproducible notebooks.

Don't get bit by misaligned state and output, keep your notebooks running with these functional tips!

An interactive notebook is available to experiment with these concepts: https://nextjournal.com/schmudde/dr-schmoods-notebook