Change the future

Saturday 1:55 p.m.–2:25 p.m.

Teaching with the IPython Notebook

Matt Davis

Audience level:


The IPython Notebook offers a number of advantages when teaching programming. It eliminates the need to switch between the command line and an editor, provides a consistent interface for students, and provides an easy to share and reuse file format. I’ll discuss how I and others are using the IPython Notebook to reduce the mental load on students to make learning and teaching easier for everyone.


Students learning to program need to master both computational concepts and a whole new language for expressing those concepts. These are challenging tasks under the best conditions and students can become overwhelmed by an onslaught of unfamiliar topics including the command line, code editors, and environment variables. While these are undoubtedly important, they are not strict prerequisites to learning programming or Python. Minimizing students’ mental loads allows them to focus on the core computational ideas like loops, control flow and functions.

The IPython Notebook, added to IPython in 2012, provides a programming environment that offers many advantages for students and instructors:

  • Code is written and run within the Notebook, eliminating any need to switch between an editor and the command line.
  • As in the standard interactive Python prompt, code and output appear next to each other and it is easy to see the effect of changes to the code.
  • Unlike the standard interactive prompt, the Notebook allows for easy editing and repeat running of multi-line code blocks. It also has some of the convenient features of code editors such as syntax highlighting, auto-completion, and
    automatic indenting.
  • Notebooks have multiple ways of showing docstrings that can be viewed while typing code.
  • Notebooks have a consistent appearance across browsers and platforms so that students see instructors demonstrating concepts in the same environment they are using.

These features allow students to spend nearly all of a learning session in the Notebook writing Python with a minimum of other distractions. In addition the Notebook has many other benefits, such as allowing for rich annotation and being easily saved and shared.

The IPython Notebook has become the environment of choice for introducing Python in Software Carpentry bootcamps. I will discuss my experience and that of other Software Carpentry instructors teaching with the IPython Notebook and give recommendations for others interested in doing the same.