Skip to content
Python for Quantitative Finance / Files, Exceptions, and Modules

Overview

Every program built so far has run in isolation: no data saved between runs, no way to recover gracefully from an unanticipated input, and no way to spread growing code across more than one file. This topic gives a program three ways to interact responsibly with the world beyond its own single run: modules, for organising code across multiple files; files, for saving and loading data between runs; and exceptions and assertions, for handling the inevitable moment when something does not go as planned. docs/programme-profiles/library/introduction-to-python.md names this Stage 5 "programs that touch the outside world," and closes it with the reproducibility habits (fixed seeds, documented file formats, informative failures) that every later quant-finance and statistics lesson in this vault assumes when it shows Python code that loads data or writes results.

In this lesson

  1. Learning objectives
  2. Contents
  3. The big picture

The full lesson is for members.

Read the full lesson

New to SelfMadeQuant.com? See membership options or browse the Python for Quantitative Finance syllabus.