Several people have asked "why not a Jupyter notebook?" There are several reasons, but one is that notebooks require each cell to be a runnable piece of code. For explanatory purposes, authors frequently want to show excerpts or snippets, e.g., a few lines from a function or one method from a class. There are ways to do this with notebooks, but they're all very clumsy.
Comments
Several people have asked "why not a Jupyter notebook?" There are several reasons, but one is that notebooks require each cell to be a runnable piece of code. For explanatory purposes, authors frequently want to show excerpts or snippets, e.g., a few lines from a function or one method from a class. There are ways to do this with notebooks, but they're all very clumsy.